texlive[72925] Master/texmf-dist: extractbb (21nov24, redux)
commits+mseven at tug.org
commits+mseven at tug.org
Thu Nov 21 23:25:15 CET 2024
Revision: 72925
https://tug.org/svn/texlive?view=revision&revision=72925
Author: mseven
Date: 2024-11-21 23:25:15 +0100 (Thu, 21 Nov 2024)
Log Message:
-----------
extractbb (21nov24, redux)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/man/man1/extractbb.man1.pdf
trunk/Master/texmf-dist/doc/support/extractbb/README.md
trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua
trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua
trunk/Master/texmf-dist/scripts/extractbb/extractbb.lua
Modified: trunk/Master/texmf-dist/doc/man/man1/extractbb.man1.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/extractbb/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/extractbb/README.md 2024-11-21 21:11:06 UTC (rev 72924)
+++ trunk/Master/texmf-dist/doc/support/extractbb/README.md 2024-11-21 22:25:15 UTC (rev 72925)
@@ -78,4 +78,4 @@
licence file.)
---
-_v1.0.5 (2024-11-21)_ <!--%%version %%dashdate-->
+_v1.0.6 (2024-11-21)_ <!--%%version %%dashdate-->
Modified: trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua 2024-11-21 21:11:06 UTC (rev 72924)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua 2024-11-21 22:25:15 UTC (rev 72925)
@@ -75,7 +75,7 @@
-- Pre-sandbox variables/constants
local show_errors = true
local SOURCE_DATE_EPOCH = tonumber(os.getenv("SOURCE_DATE_EPOCH"))
-local version = "extractbb.lua v1.0.5 (2024-11-21)" --%%version %%dashdate
+local version = "extractbb.lua v1.0.6 (2024-11-21)" --%%version %%dashdate
-- Required for any kpathsea calls to work.
kpse.set_program_name("texlua", "extractbb")
Modified: trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua 2024-11-21 21:11:06 UTC (rev 72924)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua 2024-11-21 22:25:15 UTC (rev 72925)
@@ -230,7 +230,7 @@
-- Show version information
if this_arg:match("%-version") then
- print("[Wrapped by extractbb.lua v1.0.5 (2024-11-21)]") --%%version %%dashdate
+ print("[Wrapped by extractbb.lua v1.0.6 (2024-11-21)]") --%%version %%dashdate
end
end
Modified: trunk/Master/texmf-dist/scripts/extractbb/extractbb.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/extractbb/extractbb.lua 2024-11-21 21:11:06 UTC (rev 72924)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb.lua 2024-11-21 22:25:15 UTC (rev 72925)
@@ -7,7 +7,7 @@
-- A wrapper script to allow you to choose which implementation of extractbb to
-- use. Should hopefully be replaced with the ``scratch'' file in TeX Live 2025.
--
--- v1.0.5 (2024-11-21) %%version %%dashdate
+-- v1.0.6 (2024-11-21) %%version %%dashdate
---------------------
--- Configuration ---
@@ -31,6 +31,7 @@
end
-- Flush and exit
+ io.stderr:write("\n")
io.stderr:flush()
os.exit(1)
end
@@ -47,11 +48,32 @@
return os.exec(arg)
end
+-- Find the subscripts
+kpse.set_program_name("texlua", "extractbb")
+
+local function find_script(name)
+ -- Find the script, searching **only** in the scripts directories.
+ local path = kpse.lookup(
+ name,
+ { path = kpse.var_value("TEXMFSCRIPTS"), format = "lua" }
+ )
+
+ -- Make sure that the script is not writable.
+ if kpse.out_name_ok_silent_extended(path) then
+ if os.env["TEXLIVE_EXTRACTBB_UNSAFE"] == "unsafe" then
+ -- If we're running in development mode, then we can allow this.
+ else
+ error("Refusing to run a writable script.")
+ end
+ end
+
+ return path
+end
+
-- Map the choice names to file names.
-kpse.set_program_name("texlua", "extractbb")
local choice_mapping = {
- wrapper = kpse.find_file("extractbb-wrapper.lua", "lua", true),
- scratch = kpse.find_file("extractbb-scratch.lua", "lua", true),
+ wrapper = find_script("extractbb-wrapper.lua"),
+ scratch = find_script("extractbb-scratch.lua"),
}
-- Choose the implementation to run.
@@ -61,28 +83,5 @@
error("No implementation of extractbb found.")
end
--- Make sure that the script is not writable.
-if kpse.out_name_ok_silent_extended(choice) then
- if os.env["TEXLIVE_EXTRACTBB_UNSAFE"] == "unsafe" then
- -- If we're running in development mode, then we can allow this.
- else
- error("Refusing to run a writable script.")
- end
-end
-
--- Make sure that the script is beside this one, just to be safe
-local split_dir_pattern = "^(.*)[/\\]([^/\\]-)$"
-local current_dir, current_name = arg[0]:match(split_dir_pattern)
-local choice_dir, choice_name = choice:match(split_dir_pattern)
-
-if current_dir ~= choice_dir then
- -- Resolve the symlinks and try again
- current_dir = lfs.symlinkattributes(current_dir, "target")
- choice_dir = lfs.symlinkattributes(choice_dir, "target")
- if current_dir ~= choice_dir then
- error("Refusing to run a script from a different directory.")
- end
-end
-
-- And run it.
dofile(choice)
More information about the tex-live-commits
mailing list.