diff options
author | Karl Berry <karl@freefriends.org> | 2021-02-08 14:45:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-02-08 14:45:56 +0000 |
commit | 6d9549e0bcf200ceaf3d7e30e2efb4e84daee441 (patch) | |
tree | 7a85ecae1def17e73726a43345da1c29b1967854 /Build | |
parent | 7b52bd0a112c2d889df520f6b58ea673d7eee9ab (diff) |
dvips: exit with bad status if an image is not found
git-svn-id: svn://tug.org/texlive/trunk@57678 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/dvipsk/ChangeLog | 13 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/NEWS | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/dvips.c | 3 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/output.c | 9 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/protos.h | 3 | ||||
-rwxr-xr-x | Build/source/texk/dvipsk/test-missing-image.test | 15 | ||||
-rw-r--r-- | Build/source/texk/dvipsk/testdata/missing-image.dvi | bin | 0 -> 240 bytes | |||
-rw-r--r-- | Build/source/texk/dvipsk/testdata/missing-image.tex | 6 |
8 files changed, 47 insertions, 7 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index f767063cbfb..c884d23dab6 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,16 @@ +2021-02-08 Karl Berry <karl@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@t-lab.opal.ne.jp> * NEWS: Mention new/jfm feature. diff --git a/Build/source/texk/dvipsk/NEWS b/Build/source/texk/dvipsk/NEWS index ae5552e76df..b7cb6dcc6f2 100644 --- a/Build/source/texk/dvipsk/NEWS +++ b/Build/source/texk/dvipsk/NEWS @@ -2,9 +2,10 @@ $Id$ 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. diff --git a/Build/source/texk/dvipsk/dvips.c b/Build/source/texk/dvipsk/dvips.c index 6971edf813e..e6aafb6f5b6 100644 --- a/Build/source/texk/dvipsk/dvips.c +++ b/Build/source/texk/dvipsk/dvips.c @@ -87,6 +87,7 @@ FILE *generic_fsyscp_fopen(const char *filename, const char *mode) /* 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 @@ default: #endif } #endif - return 0; + return found_problems ? EXIT_FAILURE : EXIT_SUCCESS; /*NOTREACHED*/ } #ifdef VMS diff --git a/Build/source/texk/dvipsk/output.c b/Build/source/texk/dvipsk/output.c index 650323a372c..84c91b4ee18 100644 --- a/Build/source/texk/dvipsk/output.c +++ b/Build/source/texk/dvipsk/output.c @@ -177,19 +177,20 @@ copyfile_general(const char *s, struct header_list *cur_header) 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 diff --git a/Build/source/texk/dvipsk/protos.h b/Build/source/texk/dvipsk/protos.h index 0457b9f86d4..1cc8b8ba090 100644 --- a/Build/source/texk/dvipsk/protos.h +++ b/Build/source/texk/dvipsk/protos.h @@ -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 @@ extern int pagecounter; #endif /* global variables from dvips.c */ +extern int found_problems; extern char *downloadedpsnames[]; extern int unused_top_of_psnames; extern fontdesctype *fonthead; diff --git a/Build/source/texk/dvipsk/test-missing-image.test b/Build/source/texk/dvipsk/test-missing-image.test new file mode 100755 index 00000000000..86cb8a49f57 --- /dev/null +++ b/Build/source/texk/dvipsk/test-missing-image.test @@ -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 diff --git a/Build/source/texk/dvipsk/testdata/missing-image.dvi b/Build/source/texk/dvipsk/testdata/missing-image.dvi Binary files differnew file mode 100644 index 00000000000..0805a1f8210 --- /dev/null +++ b/Build/source/texk/dvipsk/testdata/missing-image.dvi diff --git a/Build/source/texk/dvipsk/testdata/missing-image.tex b/Build/source/texk/dvipsk/testdata/missing-image.tex new file mode 100644 index 00000000000..1fcb69f2ed2 --- /dev/null +++ b/Build/source/texk/dvipsk/testdata/missing-image.tex @@ -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 |