summaryrefslogtreecommitdiff
path: root/support/epstopdf
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-10 03:02:05 +0000
committerNorbert Preining <norbert@preining.info>2023-07-10 03:02:05 +0000
commitab107e0f744efc9a2173da9b69e53fd83183988a (patch)
treeeae382ec2f34423a83429e92ec81734bc621e376 /support/epstopdf
parentfb9a8ffb415de6aca48954ade22852bc93eb7f89 (diff)
CTAN sync 202307100302
Diffstat (limited to 'support/epstopdf')
-rw-r--r--support/epstopdf/epstopdf.116
-rw-r--r--support/epstopdf/epstopdf.man1.pdfbin30644 -> 30865 bytes
-rwxr-xr-xsupport/epstopdf/epstopdf.pl61
3 files changed, 68 insertions, 9 deletions
diff --git a/support/epstopdf/epstopdf.1 b/support/epstopdf/epstopdf.1
index 6f15248560..527ed16d4c 100644
--- a/support/epstopdf/epstopdf.1
+++ b/support/epstopdf/epstopdf.1
@@ -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 @@ This must be used if a gs option or its value contains whitespace.
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 @@ reproduced.
\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 @@ Oberdiek, and many others. Currently maintained by Karl Berry.
.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 $
diff --git a/support/epstopdf/epstopdf.man1.pdf b/support/epstopdf/epstopdf.man1.pdf
index a7b5e00d7e..3b7270b154 100644
--- a/support/epstopdf/epstopdf.man1.pdf
+++ b/support/epstopdf/epstopdf.man1.pdf
Binary files differ
diff --git a/support/epstopdf/epstopdf.pl b/support/epstopdf/epstopdf.pl
index 6f0637ad28..d6bf66b2d8 100755
--- a/support/epstopdf/epstopdf.pl
+++ b/support/epstopdf/epstopdf.pl
@@ -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 @@ my $ver = "2.31";
### 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 errorUsage { die "$program: Error: @_ (try --help for more information)\n";
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
@@ -501,13 +505,60 @@ if ($restricted && $on_windows) {
use File::Basename;
my $mydirname = dirname $0;
# $mydirname is the location of the Perl script
- $kpsewhich = "$mydirname/../../../bin/win32/$kpsewhich";
+ $kpsewhich = "$mydirname/../../../bin/windows/$kpsewhich";
debug "Restricted Windows kpsewhich: $kpsewhich";
$GS = "$mydirname/../../../tlpkg/tlgs/bin/$GS";
debug "Restricted Windows gs: $GS";
}
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 @@ if ($::opt_gscmd) {
$GS = $::opt_gscmd;
}
}
+debug "GS command: $GS";
+check_prog_exists ($GS);
### option (no)safer
my $gs_opt_safer = "-dSAFER";