texlive[71665] trunk: doc,sync

commits+karl at tug.org commits+karl at tug.org
Mon Jul 1 00:18:11 CEST 2024


Revision: 71665
          https://tug.org/svn/texlive?view=revision&revision=71665
Author:   karl
Date:     2024-07-01 00:18:11 +0200 (Mon, 01 Jul 2024)
Log Message:
-----------
doc,sync

Modified Paths:
--------------
    trunk/Build/source/texk/tests/TeXLive/TLUtils.pm
    trunk/Build/source/texk/texlive/windows_wrapper/runscript.tlu
    trunk/Master/texmf-dist/scripts/texlive/NEWS

Added Paths:
-----------
    trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua

Modified: trunk/Build/source/texk/tests/TeXLive/TLUtils.pm
===================================================================
--- trunk/Build/source/texk/tests/TeXLive/TLUtils.pm	2024-06-30 22:17:00 UTC (rev 71664)
+++ trunk/Build/source/texk/tests/TeXLive/TLUtils.pm	2024-06-30 22:18:11 UTC (rev 71665)
@@ -7,7 +7,7 @@
 
 package TeXLive::TLUtils;
 
-my $svnrev = '$Revision: 71007 $';
+my $svnrev = '$Revision: 71593 $';
 my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
 sub module_revision { return $_modulerevision; }
 
@@ -2643,7 +2643,7 @@
 
   if (!$checksum && !$checksize) {
     tlwarn("$fn_name: neither checksum nor checksize " .
-           "available for $xzfile, cannot check integrity"); 
+           "available for $xzfile, cannot check integrity\n"); 
     return;
   }
   

Added: trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua	                        (rev 0)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua	2024-06-30 22:18:11 UTC (rev 71665)
@@ -0,0 +1,247 @@
+#!/usr/bin/env texlua
+-- $Id: extractbb.lua 71664 2024-06-30 22:17:00Z karl $
+-- SPDX-License-Identifier: CC0-1.0
+-- SPDX-FileCopyrightText: 2024 Max Chernoff
+--
+-- A generic wrapper to make commands safe to run with restricted shell escape.
+-- 
+-- Originally created for extractbb, which is listed in shell_escape_commands,
+-- but can be run as dvipdfm(x), which in turn can run arbitrary commands
+-- using its -D option.
+-- 
+-- The idea is to exec "ebb --ebb <other args>", since only argv[1] is
+-- used by dvipdfmx to determine its behavior.
+--
+-- Note: This script can only adjust the paths and arguments of the target
+-- executable; it *CANNOT* make an arbitrary program safe to run with
+-- restricted shell escape.
+
+-- A shorter, less paranoid version.
+-- (Prepend a hyphen to the line below to enable).
+--[=[
+arg[0] = arg[0]:gsub("extractbb", "ebb")
+table.insert(arg, 1, "ebb")
+table.insert(arg, 2, "--ebb")
+os.exec(arg)
+os.exit(1)
+--]=]
+
+---------------------
+--- Configuration ---
+---------------------
+
+-- The base name of this script. (Example: ``extractbb'')
+local SCRIPT_NAME = "extractbb"
+
+-- The extension of the script. Extensionless-names are also permitted.
+-- (Example: ``lua'')
+local SCRIPT_EXT = "lua"
+
+-- The base name of the path to the target program. (Example: ``xdvipdfmx'')
+local TARGET_PATH_NAME = "xdvipdfmx"
+
+-- The name to use when calling the target program. Equivalent to ``argv[0]''
+-- in C. (Example: ``extractbb'')
+local TARGET_EXEC_NAME = "ebb"
+
+-- Any extra arguments to be prepended to the target program, before any
+-- user-supplied arguments. Equivalent to ``argv[1], ...'' in C.
+-- (Example: ``--extractbb'')
+local TARGET_PREPEND_ARGS = { "--ebb" }
+
+-- Any extra arguments to be appended to the target program, after any
+-- user-supplied arguments. Equivalent to ``..., argv[argc]'' in C.
+local TARGET_APPEND_ARGS = {}
+
+-- Sets the value of ``openin_any'' to this value. If ``nil'', then the value
+-- will be left unchanged. (Example: ``r'')
+local READ_PERMS = "r"
+
+-- Sets the value of ``openout_any'' to this value. If ``nil'', then the value
+-- will be left unchanged. (Example: ``p'')
+local WRITE_PERMS = "p"
+
+-- The name of the Lua interpreter. (Example: ``texlua'')
+local INTERPRETER_NAME = "texlua"
+
+-- The extension of the interpreter. Extensionless-names are also permitted.
+-- (Example: ``exe'')
+local INTERPRETER_EXT = "exe"
+
+
+----------------------
+--- Initialization ---
+----------------------
+
+-- Save often-used globals for a slight speed boost.
+local insert = table.insert
+
+-- Set the kpathsea program name
+kpse.set_program_name(INTERPRETER_NAME, SCRIPT_NAME)
+
+-- Rename the input arguments so we don't get confused
+local script_args = arg
+
+
+----------------------------
+--- Function Definitions ---
+----------------------------
+
+-- Error messages
+local function error(message)
+    io.stderr:write("! ERROR (extractbb.lua): " .. message, "\n")
+    io.stderr:write(debug.traceback(nil, 2), "\n")
+    io.stderr:flush()
+    os.exit(1)
+end
+
+-- Get the directory, name, and extension from a full path. We'll split on
+-- either a forward or backward slash---Windows can use either, and we don't
+-- need to support Unix systems with TL installed to a directory with
+-- backslashes in its name.
+local split_dir_pattern = "^(.*)[/\\]([^/\\]-)$"
+local split_ext_pattern = "(.*)%.([^.]-)$"
+
+local function split_path(path)
+    -- Make sure that we were given a string
+    if type(path) ~= "string" then
+        return nil, nil, nil
+    end
+
+    -- Split the (directory) from the (name and extension)
+    local dir, name_ext = path:match(split_dir_pattern)
+
+    -- No directory
+    if not dir then
+        dir      = nil
+        name_ext = path
+
+    -- A bare directory (with a trailing slash)
+    elseif name_ext == "" then
+        return dir, nil, nil
+    end
+
+    -- Split the (name) from the (extension)
+    local name, ext = name_ext:match(split_ext_pattern)
+
+    -- No extension (or a dotfile)
+    if (not name) or (name == "") then
+        name = name_ext
+        ext  = nil
+    end
+
+    return dir, name, ext
+end
+
+-- See if a file exists
+local function file_exists(path)
+    local mode = lfs.attributes(path, "mode")
+    return (mode == "file") or (mode == "link")
+end
+
+
+---------------------
+--- Safety Checks ---
+---------------------
+
+-- Make sure that we're running unrestricted.
+if status.shell_escape ~= 1 then
+    error("Shell escape has been disabled.")
+end
+
+if status.safer_option ~= 0 then
+    error("The ``safer'' option has been enabled.")
+end
+
+-- Set the file permissions.
+if READ_PERMS then
+    os.setenv("openin_any", READ_PERMS)
+end
+
+if WRITE_PERMS then
+    os.setenv("openout_any", WRITE_PERMS)
+end
+
+-- Get the directory of the script and interpreter
+local script_path = debug.getinfo(1, "S").source:sub(2)
+local script_dir, script_name, script_ext = split_path(script_path)
+
+local interpreter_dir = kpse.var_value("SELFAUTOLOC")
+local _, interpreter_name, interpreter_ext = split_path(script_args[-1])
+if os.type == 'windows' then
+    interpreter_ext = INTERPRETER_EXT
+end
+-- Look up the script again with kpathsea
+local resolved_script_path = kpse.find_file(
+    script_name .. "." .. (script_ext or SCRIPT_EXT), "texmfscripts", true
+)
+
+-- Make sure that our paths are correct
+if not script_dir then
+    error("Empty script dir")
+end
+
+if not resolved_script_path then
+    error("Empty resolved script path")
+end
+
+if (script_dir ~= interpreter_dir) and (script_path ~= resolved_script_path) then
+    error("The script is in an incorrect location: " .. script_dir)
+end
+
+if script_name ~= SCRIPT_NAME then
+    error("Incorrect script name: " .. script_name)
+end
+
+if interpreter_name ~= INTERPRETER_NAME then
+    error("Incorrect interpreter name: " .. interpreter_name)
+end
+
+if (script_ext ~= SCRIPT_EXT) and (script_ext ~= nil) then
+    error("Incorrect script extension: " .. script_ext)
+end
+
+if (interpreter_ext ~= INTERPRETER_EXT) and (interpreter_ext ~= nil) then
+    error("Incorrect interpreter extension: " .. interpreter_ext)
+end
+
+-- Get the path to the target program
+local target_ext  = interpreter_ext and ("." .. interpreter_ext) or ""
+local target_path = interpreter_dir .. "/" .. TARGET_PATH_NAME .. target_ext
+
+-- Make sure that the target program exists
+if not file_exists(target_path) then
+    error("The target program does not exist: " .. target_path)
+end
+
+
+----------------------
+--- Run the target ---
+----------------------
+
+-- Generate the target arguments
+local target_args = {
+    [0] = target_path,      -- Path to the executable
+    [1] = TARGET_EXEC_NAME, -- argv[0]
+}
+
+-- argv[2] through argv[n]
+for _, arg in ipairs(TARGET_PREPEND_ARGS) do
+    insert(target_args, arg)
+end
+
+for i = 1, #script_args do
+    -- We use a numeric iterator here to avoid ``arg[-1]'' and ``arg[0]''.
+    insert(target_args, script_args[i])
+end
+
+for _, arg in ipairs(TARGET_APPEND_ARGS) do
+    insert(target_args, arg)
+end
+
+-- Run the target program, replacing the current process
+local _, err = os.exec(target_args)
+
+if err then
+    error("The target program failed to run.")
+end


Property changes on: trunk/Build/source/texk/texlive/linked_scripts/texlive/extractbb.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Build/source/texk/texlive/windows_wrapper/runscript.tlu
===================================================================
--- trunk/Build/source/texk/texlive/windows_wrapper/runscript.tlu	2024-06-30 22:17:00 UTC (rev 71664)
+++ trunk/Build/source/texk/texlive/windows_wrapper/runscript.tlu	2024-06-30 22:18:11 UTC (rev 71665)
@@ -1,7 +1,7 @@
 
 
-local svnrevision = string.match("$Revision: 71041 $", "%d+") or "0"
-local svndate     = string.match("$Date: 2024-04-23 12:33:27 +0200 (Tue, 23 Apr 2024) $", "[-%d]+") or "2009-12-04"
+local svnrevision = string.match("$Revision: 71447 $", "%d+") or "0"
+local svndate     = string.match("$Date: 2024-06-06 09:46:11 +0200 (Thu, 06 Jun 2024) $", "[-%d]+") or "2009-12-04"
 local bannerstr   = "runscript wrapper utility (rev. " ..
                     svnrevision .. ", " .. svndate .. ")\n" .. 
                     "usage:   runscript script-name [arguments]\n" ..
@@ -41,15 +41,16 @@
     The following script types and their file extensions are currently 
     supported and searched in that order:
     
-      Lua      (.tlu;.texlua;.lua) --  included
-      Perl     (.pl)               --  included
-      Ruby     (.rb)               --  requires installation
-      Python   (.py)               --  requires installation
-      Tcl      (.tcl)              --  included (GUI scripts only)
-      Java     (.jar)              --  requires installation
-      VBScript (.vbs)              --  part of Windows
-      JScript  (.js)               --  part of Windows
-      Batch    (.bat;.cmd)         --  part of Windows
+      Lua        (.tlu;.texlua;.lua) --  included
+      Perl       (.pl)               --  included
+      Ruby       (.rb)               --  requires installation
+      Python     (.py)               --  requires installation
+      Tcl        (.tcl)              --  included (GUI scripts only)
+      Java       (.jar)              --  requires installation
+      Powershell (.ps1)              --  part of Windows
+      VBScript   (.vbs)              --  part of Windows
+      JScript    (.js)               --  part of Windows
+      Batch      (.bat;.cmd)         --  part of Windows
     
     Finally, Unix-style extensionless scripts are searched as last and 
     the interpreter program is established based on the she-bang (#!) 
@@ -744,10 +745,11 @@
   ['.py' ] = {'python.exe'},
   ['.rb' ] = {'ruby.exe'},
   ['.tcl'] = {'tclsh.exe tclsh86.exe tclsh85.exe tclkitsh.exe'},
+  ['.ps1'] = {'powershell.exe',  '-NoLogo', '-ExecutionPolicy', 'Bypass', '-file'},
   ['.vbs'] = {'cscript.exe', '-nologo'},
 }
 if guimode then
-  -- for GUI mode wrappers we try GUI mode interpeters where possible
+  -- for GUI mode wrappers we try GUI mode interpreters where possible
   extension_map['.jar'][1] = 'javaw.exe '   .. extension_map['.jar'][1]
   extension_map['.pl' ][1] = 'wperl.exe '   .. extension_map['.pl' ][1]
   extension_map['.py' ][1] = 'pythonw.exe ' .. extension_map['.py' ][1]
@@ -754,6 +756,8 @@
   extension_map['.rb' ][1] = 'rubyw.exe '   .. extension_map['.rb' ][1]
   -- gui tcl shares no interpreters with non-gui tcl
   extension_map['.tcl'] = {'wish.exe wish86.exe wish85.exe tclkit.exe'}
+  extension_map['.ps1'] = {'powershell.exe',  '-NoLogo', '-ExecutionPolicy', 'Bypass',
+      '-WindowStyle', 'hidden', '-file'}
   extension_map['.vbs'][1] = 'wscript.exe ' .. extension_map['.vbs'][1]
 end
 extension_map['.cmd'] = extension_map['.bat']
@@ -850,7 +854,7 @@
 
 if not ARGV then
   os.setenv('TEXMF', TEXMFDIST)
-  local extlist = '.lua;.tlu;.pl;.rb;.py;.tcl;.jar;.vbs;.js;.bat;.cmd;.texlua;\0'
+  local extlist = '.lua;.tlu;.pl;.rb;.py;.tcl;.jar;.ps1;.vbs;.js;.bat;.cmd;.texlua;\0'
   local progfullname = search_path(progname, BINDIR, '.lua;.tlu;.bat;.cmd;.pl') or
                        find_texmfscript(progname, extlist)
   os.setenv('TEXMF', nil)

Modified: trunk/Master/texmf-dist/scripts/texlive/NEWS
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/NEWS	2024-06-30 22:17:00 UTC (rev 71664)
+++ trunk/Master/texmf-dist/scripts/texlive/NEWS	2024-06-30 22:18:11 UTC (rev 71665)
@@ -1,6 +1,9 @@
 (This file public domain.  Originally written by Norbert Preining and
 Karl Berry, 2010.)
 
+<p><b>TLUtils.pm 71593 (released 23jun24):</b>
+<li>typo caused tlmgr install --file to fail.
+
 <p><b>tlmgr 71331 (released 18jun24):</b>
 <li>tlmgr search: format to avoid Perl warnings.
 



More information about the tex-live-commits mailing list.