texlive[67591] trunk: epstopdf (9jul23)
commits+karl at tug.org
commits+karl at tug.org
Sun Jul 9 21:48:32 CEST 2023
Revision: 67591
http://tug.org/svn/texlive?view=revision&revision=67591
Author: karl
Date: 2023-07-09 21:48:32 +0200 (Sun, 09 Jul 2023)
Log Message:
-----------
epstopdf (9jul23)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl
trunk/Master/texmf-dist/doc/man/man1/epstopdf.1
trunk/Master/texmf-dist/doc/man/man1/epstopdf.man1.pdf
trunk/Master/texmf-dist/doc/man/man1/repstopdf.man1.pdf
trunk/Master/texmf-dist/scripts/epstopdf/epstopdf.pl
Modified: trunk/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl 2023-07-09 15:28:53 UTC (rev 67590)
+++ trunk/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl 2023-07-09 19:48:32 UTC (rev 67591)
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: epstopdf.pl 66407 2023-03-06 23:44:49Z karl $
+# $Id: epstopdf.pl 67585 2023-07-08 21:10:52Z karl $
# (Copyright lines below.)
#
# Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,10 @@
#
# emacs-page
#
-my $ver = "2.31";
+my $ver = "2.32";
+# 2023/07/08 2.32 (Karl Berry)
+# * check that kpsewhich and gs are in PATH.
+# * correct TL path for kpsewhich to bin/windows.
# 2023/03/06 v2.31 (Karl Berry)
# * disallow --nosafer in restricted mode.
# * disallow output to pipes in restricted mode.
@@ -197,7 +200,7 @@
### emacs-page
### program identification
my $program = "epstopdf";
-my $ident = '($Id: epstopdf.pl 66407 2023-03-06 23:44:49Z karl $)' . " $ver";
+my $ident = '($Id: epstopdf.pl 67585 2023-07-08 21:10:52Z karl $)' . " $ver";
my $copyright = <<END_COPYRIGHT ;
Copyright 2009-2023 Karl Berry et al.
Copyright 2002-2009 Gerben Wierda et al.
@@ -493,6 +496,7 @@
sub warnerr { $restricted ? error(@_) : warning(@_); }
### debug messages
+debug "on_windows=$on_windows, on_windows_or_cygwin=$on_windows_or_cygwin";
debug "Restricted mode activated" if $restricted;
### safer external commands for Windows in restricted mode
@@ -508,6 +512,53 @@
}
debug "kpsewhich command: $kpsewhich";
+### check that PROG is in PATH and executable, abort if not. It'd be
+# better to actually try running the program, but then we'd have to
+# either replicate Perl's logic for finding the command interpreter
+# (trivial on Unix, complicated on Windows), or do a fork/exec and close
+# the file descriptors ourselves, which seems too painful. Nor do we
+# want to load/assume File::Which. Instead we'll look along PATH
+# ourselves, which is good enough in practice for us, since the only
+# goal here is to give a better error message if the program isn't
+# available.
+sub check_prog_exists {
+ my ($prog) = @_;
+ my @w_ext = ("exe", "com", "bat");
+ debug " Checking if $prog is in PATH";
+
+ # absolute unix
+ if (! $on_windows_or_cygwin && $prog =~ m,^((\.(\.)?)?/),) {
+ return 1 if -x $prog; # absolute or explicitly relative
+ error "Required program $prog not found, given explicit directory";
+
+ # absolute windows: optional drive letter, then . or .., then \ or /.
+ } elsif ($on_windows_or_cygwin
+ && $prog =~ m,^(([a-zA-Z]:)?(\.(\.)?)?[/\\]),) {
+ return 1 if -x $prog;
+ for my $ext (@w_ext) {
+ return 1 if (-x "$prog.$ext");
+ }
+ error "Required program $prog not found, given explicit Windows directory";
+ }
+
+ # not absolute, check path
+ for my $dir (split ($on_windows_or_cygwin ? ";" : ":", $ENV{"PATH"})) {
+ $dir = "." if $dir eq ""; # empty path element
+ debug " Checking dir $dir";
+ if (-x "$dir/$prog") {
+ return 1;
+ } elsif ($on_windows_or_cygwin) {
+ for my $ext (@w_ext) {
+ return 1 if (-x "$dir/$prog.$ext");
+ }
+ }
+ }
+
+ # if made it through the whole loop, not found, so quit.
+ error "Required program $prog not found in PATH ($ENV{PATH})";
+}
+check_prog_exists ($kpsewhich);
+
### check if a name is "safe" according to kpse's open(in|out)_any
# return true if name is ok, false otherwise
sub safe_name {
@@ -574,6 +625,8 @@
$GS = $::opt_gscmd;
}
}
+debug "GS command: $GS";
+check_prog_exists ($GS);
### option (no)safer
my $gs_opt_safer = "-dSAFER";
Modified: trunk/Master/texmf-dist/doc/man/man1/epstopdf.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/epstopdf.1 2023-07-09 15:28:53 UTC (rev 67590)
+++ trunk/Master/texmf-dist/doc/man/man1/epstopdf.1 2023-07-09 19:48:32 UTC (rev 67591)
@@ -1,5 +1,5 @@
-.TH EPSTOPDF 1 "6 March 2023"
-.\" $Id: epstopdf.1 66408 2023-03-06 23:45:51Z karl $
+.TH EPSTOPDF 1 "8 July 2023"
+.\" $Id: epstopdf.1 67585 2023-07-08 21:10:52Z karl $
.SH NAME
epstopdf, repstopdf \- convert an EPS file to PDF
.SH SYNOPSIS
@@ -118,6 +118,10 @@
In restricted mode, options are limited to those with names and values
known to be safe. Some options taking booleans, integers or fixed
names are allowed, those taking general strings are not.
+.PP
+In order to give a comprehensible error message, epstopdf checks whether
+kpsewhich and (the specified) gs are found in the current PATH, or
+executable if they are specified as absolute names.
.SH EXAMPLES
These examples all equivalently convert `test.eps' to `test.pdf':
@@ -153,7 +157,7 @@
\fBpdfcrop\fP(1).
.PP
The epstopdf LaTeX package, which automates running this script on the
-fly under TeX: https://ctan.org/pkg/epstopdf-pkg.
+fly under LaTeX: https://ctan.org/pkg/epstopdf-pkg.
.SH AUTHOR
Originally written by Sebastian Rahtz, for Elsevier Science, with
subsequent contributions from Thomas Esser, Gerben Wierda, Heiko
@@ -161,9 +165,11 @@
.PP
Man page originally written by Jim Van Zandt.
.PP
+epstopdf package page on CTAN: https://ctan.org/pkg/epstopdf.
+.PP
epstopdf home page: https://tug.org/epstopdf.
.PP
You may freely use, modify and/or distribute this man page.
-The epstopdf script is released under a modified BSD license.
+The epstopdf script is released under the modified BSD license.
.PP
-$Id: epstopdf.1 66408 2023-03-06 23:45:51Z karl $
+$Id: epstopdf.1 67585 2023-07-08 21:10:52Z karl $
Modified: trunk/Master/texmf-dist/doc/man/man1/epstopdf.man1.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/man/man1/repstopdf.man1.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/scripts/epstopdf/epstopdf.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/epstopdf/epstopdf.pl 2023-07-09 15:28:53 UTC (rev 67590)
+++ trunk/Master/texmf-dist/scripts/epstopdf/epstopdf.pl 2023-07-09 19:48:32 UTC (rev 67591)
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: epstopdf.pl 66407 2023-03-06 23:44:49Z karl $
+# $Id: epstopdf.pl 67585 2023-07-08 21:10:52Z karl $
# (Copyright lines below.)
#
# Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,10 @@
#
# emacs-page
#
-my $ver = "2.31";
+my $ver = "2.32";
+# 2023/07/08 2.32 (Karl Berry)
+# * check that kpsewhich and gs are in PATH.
+# * correct TL path for kpsewhich to bin/windows.
# 2023/03/06 v2.31 (Karl Berry)
# * disallow --nosafer in restricted mode.
# * disallow output to pipes in restricted mode.
@@ -197,7 +200,7 @@
### emacs-page
### program identification
my $program = "epstopdf";
-my $ident = '($Id: epstopdf.pl 66407 2023-03-06 23:44:49Z karl $)' . " $ver";
+my $ident = '($Id: epstopdf.pl 67585 2023-07-08 21:10:52Z karl $)' . " $ver";
my $copyright = <<END_COPYRIGHT ;
Copyright 2009-2023 Karl Berry et al.
Copyright 2002-2009 Gerben Wierda et al.
@@ -493,6 +496,7 @@
sub warnerr { $restricted ? error(@_) : warning(@_); }
### debug messages
+debug "on_windows=$on_windows, on_windows_or_cygwin=$on_windows_or_cygwin";
debug "Restricted mode activated" if $restricted;
### safer external commands for Windows in restricted mode
@@ -508,6 +512,53 @@
}
debug "kpsewhich command: $kpsewhich";
+### check that PROG is in PATH and executable, abort if not. It'd be
+# better to actually try running the program, but then we'd have to
+# either replicate Perl's logic for finding the command interpreter
+# (trivial on Unix, complicated on Windows), or do a fork/exec and close
+# the file descriptors ourselves, which seems too painful. Nor do we
+# want to load/assume File::Which. Instead we'll look along PATH
+# ourselves, which is good enough in practice for us, since the only
+# goal here is to give a better error message if the program isn't
+# available.
+sub check_prog_exists {
+ my ($prog) = @_;
+ my @w_ext = ("exe", "com", "bat");
+ debug " Checking if $prog is in PATH";
+
+ # absolute unix
+ if (! $on_windows_or_cygwin && $prog =~ m,^((\.(\.)?)?/),) {
+ return 1 if -x $prog; # absolute or explicitly relative
+ error "Required program $prog not found, given explicit directory";
+
+ # absolute windows: optional drive letter, then . or .., then \ or /.
+ } elsif ($on_windows_or_cygwin
+ && $prog =~ m,^(([a-zA-Z]:)?(\.(\.)?)?[/\\]),) {
+ return 1 if -x $prog;
+ for my $ext (@w_ext) {
+ return 1 if (-x "$prog.$ext");
+ }
+ error "Required program $prog not found, given explicit Windows directory";
+ }
+
+ # not absolute, check path
+ for my $dir (split ($on_windows_or_cygwin ? ";" : ":", $ENV{"PATH"})) {
+ $dir = "." if $dir eq ""; # empty path element
+ debug " Checking dir $dir";
+ if (-x "$dir/$prog") {
+ return 1;
+ } elsif ($on_windows_or_cygwin) {
+ for my $ext (@w_ext) {
+ return 1 if (-x "$dir/$prog.$ext");
+ }
+ }
+ }
+
+ # if made it through the whole loop, not found, so quit.
+ error "Required program $prog not found in PATH ($ENV{PATH})";
+}
+check_prog_exists ($kpsewhich);
+
### check if a name is "safe" according to kpse's open(in|out)_any
# return true if name is ok, false otherwise
sub safe_name {
@@ -574,6 +625,8 @@
$GS = $::opt_gscmd;
}
}
+debug "GS command: $GS";
+check_prog_exists ($GS);
### option (no)safer
my $gs_opt_safer = "-dSAFER";
More information about the tex-live-commits
mailing list.