texlive[72924] trunk: extractbb (21nov24)
commits+karl at tug.org
commits+karl at tug.org
Thu Nov 21 22:11:06 CET 2024
Revision: 72924
https://tug.org/svn/texlive?view=revision&revision=72924
Author: karl
Date: 2024-11-21 22:11:06 +0100 (Thu, 21 Nov 2024)
Log Message:
-----------
extractbb (21nov24)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/extractbb/extractbb.lua
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
trunk/Master/tlpkg/libexec/ctan2tds
Added Paths:
-----------
trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf
Modified: trunk/Build/source/texk/texlive/linked_scripts/extractbb/extractbb.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/extractbb/extractbb.lua 2024-11-21 21:04:41 UTC (rev 72923)
+++ trunk/Build/source/texk/texlive/linked_scripts/extractbb/extractbb.lua 2024-11-21 21:11:06 UTC (rev 72924)
@@ -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.0 (2024-11-17) %%version %%dashdate
+-- v1.0.5 (2024-11-21) %%version %%dashdate
---------------------
--- Configuration ---
@@ -20,6 +20,21 @@
--- Execution ---
-----------------
+-- Send the error messages to stderr.
+local function error(...)
+ -- Header
+ io.stderr:write("! extractbb ERROR: ")
+
+ -- Message
+ for i = 1, select("#", ...) do
+ io.stderr:write(tostring(select(i, ...)), " ")
+ end
+
+ -- Flush and exit
+ io.stderr:flush()
+ os.exit(1)
+end
+
-- Get the value of the environment variable that decides which version to run.
local env_choice = os.env["TEXLIVE_EXTRACTBB"]
@@ -43,8 +58,7 @@
local choice = choice_mapping[env_choice] or choice_mapping[DEFAULT]
if not choice then
- print("No implementation of extractbb found. Exiting.")
- os.exit(1)
+ error("No implementation of extractbb found.")
end
-- Make sure that the script is not writable.
@@ -52,8 +66,7 @@
if os.env["TEXLIVE_EXTRACTBB_UNSAFE"] == "unsafe" then
-- If we're running in development mode, then we can allow this.
else
- print("Refusing to run a writable script. Exiting.")
- os.exit(1)
+ error("Refusing to run a writable script.")
end
end
@@ -63,8 +76,12 @@
local choice_dir, choice_name = choice:match(split_dir_pattern)
if current_dir ~= choice_dir then
- print("Refusing to run a script from a different directory. Exiting.")
- os.exit(1)
+ -- 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.
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:04:41 UTC (rev 72923)
+++ trunk/Master/texmf-dist/doc/support/extractbb/README.md 2024-11-21 21:11:06 UTC (rev 72924)
@@ -59,7 +59,7 @@
--------
Please see the file
-[`BUILDING.md`](https://github.com/gucci-on-fleek/extractbb/blob/master/BUILDING.md)
+[`documentation/BUILDING.md`](https://github.com/gucci-on-fleek/extractbb/blob/master/documentation/BUILDING.md)
on GitHub.
@@ -78,4 +78,4 @@
licence file.)
---
-_v1.0.0 (2024-11-17)_ <!--%%version %%dashdate-->
+_v1.0.5 (2024-11-21)_ <!--%%version %%dashdate-->
Added: trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf 2024-11-21 21:04:41 UTC (rev 72923)
+++ trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf 2024-11-21 21:11:06 UTC (rev 72924)
Property changes on: trunk/Master/texmf-dist/doc/support/extractbb/extractbb.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua 2024-11-21 21:04:41 UTC (rev 72923)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb-scratch.lua 2024-11-21 21:11:06 UTC (rev 72924)
@@ -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.0 (2024-11-17)" --%%version %%dashdate
+local version = "extractbb.lua v1.0.5 (2024-11-21)" --%%version %%dashdate
-- Required for any kpathsea calls to work.
kpse.set_program_name("texlua", "extractbb")
@@ -89,22 +89,30 @@
-- questionable hack to load it manually. We do it inside of "pcall" since there
-- are some exotic platforms where the "ffi" module is unsupported.
pcall(function()
- local ffi = package.loaded.ffi
+ local ffi
- ffi.cdef[[
- typedef struct lua_State lua_State;
- typedef int (*lua_CFunction) (lua_State *L);
+ if img then
+ -- Ok, we're running under a recent LuaTeX that enables the "img"
+ -- library in "texlua" mode, so we can skip the FFI hack.
+ ffi = false
+ else
+ ffi = package.loaded.ffi
- lua_State *Luas;
- void luaL_requiref(lua_State *L, const char *modname,
- lua_CFunction openf, int glb);
- int luaopen_img(lua_State * L);
+ ffi.cdef[[
+ typedef struct lua_State lua_State;
+ typedef int (*lua_CFunction) (lua_State *L);
- int lua_only;
- ]]
+ lua_State *Luas;
+ void luaL_requiref(lua_State *L, const char *modname,
+ lua_CFunction openf, int glb);
+ int luaopen_img(lua_State * L);
- -- Basic initialization
- ffi.C.lua_only = 0
+ int lua_only;
+ ]]
+
+ -- Basic initialization
+ ffi.C.lua_only = 0
+ end
tex.initialize()
-- "tex" module
@@ -120,7 +128,9 @@
pdf.setminorversion(0)
-- "img" module
- ffi.C.luaL_requiref(ffi.C.Luas, "img", ffi.C.luaopen_img, 1)
+ if ffi then
+ ffi.C.luaL_requiref(ffi.C.Luas, "img", ffi.C.luaopen_img, 1)
+ end
end)
-- In case of failure, define an empty "img" table.
@@ -323,6 +333,7 @@
-- Constants
local BP_TO_SP = 65781.76
local IN_TO_BP = 72
+local DATE_FORMAT = "%a %b %d %H:%M:%S %Y" -- "%c"
-- Save often-used globals for a slight speed boost.
local floor = math.floor
@@ -677,7 +688,7 @@
end
-insert(lines, ("CreationDate: %s"):format(os.date("%c", SOURCE_DATE_EPOCH)))
+insert(lines, ("CreationDate: %s"):format(os.date(DATE_FORMAT, SOURCE_DATE_EPOCH)))
-- Create the output text.
local begin_line = "%%"
Modified: trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua 2024-11-21 21:04:41 UTC (rev 72923)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb-wrapper.lua 2024-11-21 21:11:06 UTC (rev 72924)
@@ -230,7 +230,7 @@
-- Show version information
if this_arg:match("%-version") then
- print("[Wrapped by extractbb.lua v1.0.0 (2024-11-17)]") --%%version %%dashdate
+ print("[Wrapped by extractbb.lua v1.0.5 (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:04:41 UTC (rev 72923)
+++ trunk/Master/texmf-dist/scripts/extractbb/extractbb.lua 2024-11-21 21:11:06 UTC (rev 72924)
@@ -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.0 (2024-11-17) %%version %%dashdate
+-- v1.0.5 (2024-11-21) %%version %%dashdate
---------------------
--- Configuration ---
@@ -20,6 +20,21 @@
--- Execution ---
-----------------
+-- Send the error messages to stderr.
+local function error(...)
+ -- Header
+ io.stderr:write("! extractbb ERROR: ")
+
+ -- Message
+ for i = 1, select("#", ...) do
+ io.stderr:write(tostring(select(i, ...)), " ")
+ end
+
+ -- Flush and exit
+ io.stderr:flush()
+ os.exit(1)
+end
+
-- Get the value of the environment variable that decides which version to run.
local env_choice = os.env["TEXLIVE_EXTRACTBB"]
@@ -43,8 +58,7 @@
local choice = choice_mapping[env_choice] or choice_mapping[DEFAULT]
if not choice then
- print("No implementation of extractbb found. Exiting.")
- os.exit(1)
+ error("No implementation of extractbb found.")
end
-- Make sure that the script is not writable.
@@ -52,8 +66,7 @@
if os.env["TEXLIVE_EXTRACTBB_UNSAFE"] == "unsafe" then
-- If we're running in development mode, then we can allow this.
else
- print("Refusing to run a writable script. Exiting.")
- os.exit(1)
+ error("Refusing to run a writable script.")
end
end
@@ -63,8 +76,12 @@
local choice_dir, choice_name = choice:match(split_dir_pattern)
if current_dir ~= choice_dir then
- print("Refusing to run a script from a different directory. Exiting.")
- os.exit(1)
+ -- 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.
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2024-11-21 21:04:41 UTC (rev 72923)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2024-11-21 21:11:06 UTC (rev 72924)
@@ -3989,6 +3989,7 @@
'easydtx' => '\.1$',
'eolang' => '\.1$',
'epstopdf' => 'r?epstopdf.1|epstopdf.man1.pdf', # don't keep pdf
+ 'extractbb' => '\.1$',
'findhyph' => 'findhyph.1',
'fontools' => '\.1$',
'git-latexdiff' => '\.1$',
More information about the tex-live-commits
mailing list.