texlive[57678] Build/source/texk/dvipsk: dvips: exit with bad status

commits+karl at tug.org commits+karl at tug.org
Mon Feb 8 15:45:57 CET 2021


Revision: 57678
          http://tug.org/svn/texlive?view=revision&revision=57678
Author:   karl
Date:     2021-02-08 15:45:56 +0100 (Mon, 08 Feb 2021)
Log Message:
-----------
dvips: exit with bad status if an image is not found

Modified Paths:
--------------
    trunk/Build/source/texk/dvipsk/ChangeLog
    trunk/Build/source/texk/dvipsk/NEWS
    trunk/Build/source/texk/dvipsk/dvips.c
    trunk/Build/source/texk/dvipsk/output.c
    trunk/Build/source/texk/dvipsk/protos.h

Added Paths:
-----------
    trunk/Build/source/texk/dvipsk/test-missing-image.test
    trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi
    trunk/Build/source/texk/dvipsk/testdata/missing-image.tex

Modified: trunk/Build/source/texk/dvipsk/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipsk/ChangeLog	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/ChangeLog	2021-02-08 14:45:56 UTC (rev 57678)
@@ -1,3 +1,16 @@
+2021-02-08  Karl Berry  <karl at freefriends.org>
+
+	* dvips.c (found_problems): define.
+	(main): final exit status depends on its value.
+	* protos.h (found_problems): declare.
+	* output.c (copyfile_general): set found_problems=1 if image not found.
+	This is to match the new behavior of dvipdfmx.
+	https://tug.org/pipermail/dvipdfmx/2021-January/000159.html (thread)
+	
+	* test-missing-image.test: corresponding test.
+	* testdata/missing-image.dvi,
+	* testdata/missing-image.tex: files for new test.
+
 2020-12-05  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* NEWS: Mention new/jfm feature.

Modified: trunk/Build/source/texk/dvipsk/NEWS
===================================================================
--- trunk/Build/source/texk/dvipsk/NEWS	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/NEWS	2021-02-08 14:45:56 UTC (rev 57678)
@@ -2,9 +2,10 @@
 This file records noteworthy changes.  (Public domain.)
 
 dvips 2021.1 (TeX Live 2021):
-  Default title is now the basename of the input file isntead of the
-  full path, and can be overridden with new option -title.
+  Default title is now the basename of the input file instead of the
+    full path, and can be overridden with new option -title.
   Support new feature of virtual font to fallback Japanese font definition.
+  If an .eps or other image file is not found, dvips now exits unsuccessfully.
 
 dvips 2020.1 (TeX Live 2020):
   Encodings for bitmap fonts.

Modified: trunk/Build/source/texk/dvipsk/dvips.c
===================================================================
--- trunk/Build/source/texk/dvipsk/dvips.c	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/dvips.c	2021-02-08 14:45:56 UTC (rev 57678)
@@ -87,6 +87,7 @@
 /* PS fonts fully downloaded as headers */
 char *downloadedpsnames[DOWNLOADEDPSSIZE];
 
+int found_problems = 0;      /* should we exit successfully? */
 int unused_top_of_psnames;   /* unused top number of downloadedpsnames[#] */
 fontdesctype *fonthead;      /* list of all fonts mentioned so far */
 fontdesctype *curfnt;        /* the currently selected font */
@@ -1535,7 +1536,7 @@
 #endif
    }
 #endif
-   return 0;
+   return found_problems ? EXIT_FAILURE : EXIT_SUCCESS;
    /*NOTREACHED*/
 }
 #ifdef VMS

Modified: trunk/Build/source/texk/dvipsk/output.c
===================================================================
--- trunk/Build/source/texk/dvipsk/output.c	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/output.c	2021-02-08 14:45:56 UTC (rev 57678)
@@ -177,19 +177,20 @@
       if (secure == 2) {
          strcat(errbuf, "\nNote that an absolute path or a relative path with .. are denied in -R2 mode.");
       }
-#else /* VMCMS */
+#else /* ! VMCMS */
       sprintf(errbuf,
     "Couldn't find figure file %s with MVS name %s; continuing.", s, trunc_s);
       if (secure == 2) {
          strcat(errbuf, "\nNote that an absolute path or a relative path with .. are denied in -R2 mode.");
       }
-#endif /* VMCMS */
-#else /* VMCMS || MVSXA */
+#endif /* ! VMCMS */
+#else /*  ! (VMCMS || MVSXA) */
       sprintf(errbuf, "Could not find figure file %.500s; continuing.", s);
+      found_problems = 1; /* continue, but do not exit successfully */
       if (secure == 2) {
          strcat(errbuf, "\nNote that an absolute path or a relative path with .. are denied in -R2 mode.");
       }
-#endif /* VMCMS || MVSXA */
+#endif /* !(VMCMS || MVSXA) */
       break;
 #ifndef VMCMS
 #ifndef MVSXA

Modified: trunk/Build/source/texk/dvipsk/protos.h
===================================================================
--- trunk/Build/source/texk/dvipsk/protos.h	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/protos.h	2021-02-08 14:45:56 UTC (rev 57678)
@@ -1,5 +1,7 @@
 #ifndef _PROTOS_H_
 
+/* see dvips.h for copyright notice */
+
 #define _PROTOS_H_
 
 /* some types need declaration before being used */
@@ -258,6 +260,7 @@
 #endif
 
 /* global variables from dvips.c */
+extern int found_problems;
 extern char *downloadedpsnames[];
 extern int unused_top_of_psnames;
 extern fontdesctype *fonthead;

Added: trunk/Build/source/texk/dvipsk/test-missing-image.test
===================================================================
--- trunk/Build/source/texk/dvipsk/test-missing-image.test	                        (rev 0)
+++ trunk/Build/source/texk/dvipsk/test-missing-image.test	2021-02-08 14:45:56 UTC (rev 57678)
@@ -0,0 +1,15 @@
+#! /bin/sh -vx
+# $Id$
+# Public domain. Test that dvips exits with bad status when there is a
+# missing image file.
+# 
+# BTW, to just run this test on its own:
+# make -C $wp TESTS=test-missing-image.test check 
+# where wp=.../Work/texk/dvipsk
+
+if ./dvips $srcdir/testdata/missing-image.dvi -o dvipstst.ps; then
+  echo "$0: found image file, but shouldn't have." >&2
+  exit 1
+fi
+
+exit 0


Property changes on: trunk/Build/source/texk/dvipsk/test-missing-image.test
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi
===================================================================
--- trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi	2021-02-08 08:50:13 UTC (rev 57677)
+++ trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi	2021-02-08 14:45:56 UTC (rev 57678)

Property changes on: trunk/Build/source/texk/dvipsk/testdata/missing-image.dvi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-dvi
\ No newline at end of property
Added: trunk/Build/source/texk/dvipsk/testdata/missing-image.tex
===================================================================
--- trunk/Build/source/texk/dvipsk/testdata/missing-image.tex	                        (rev 0)
+++ trunk/Build/source/texk/dvipsk/testdata/missing-image.tex	2021-02-08 14:45:56 UTC (rev 57678)
@@ -0,0 +1,6 @@
+% $Id$
+% Include a nonexistent image file, for test-missing-image.test. Public domain.
+\nopagenumbers
+\input epsf
+\epsfbox{missing-image.eps}
+\end


Property changes on: trunk/Build/source/texk/dvipsk/testdata/missing-image.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property


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