Package: mpage
Version: 2.5.4-1
I'm running Debian GNU/Linux unstable with Linux kernel 2.6.12-1-686
Upgraded my unstable the other day and as a result got a new version of
mpage which no longer works when reading in from standard input.
For example, dump of standard error via strace:
===
$ strace mpage > /dev/null
<snipped>
write(1, "%!PS-Adobe-2.0\n%%DocumentFonts: "..., 4096) = 4096
gettimeofday({1126233247, 378296}, NULL) = 0
getpid() = 14311
open("/usr/tmp/mpage-stdin-4ioj4z", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 ENOENT
(No such file or directory)
write(2, "mpage: cannot create temporary f"..., 35mpage: cannot create
temporary file) = 35
write(2, "mpage: No such file or directory"..., 33mpage: No such file or
directory) = 33
write(1, "niks /Baekmuk-Batang-UniKS-UTF8-"..., 225) = 225
munmap(0xb7f76000, 4096) = 0
exit_group(0) = ?
===
The failure is due to mpage attempting to write temporary files in
/usr/tmp which doesn't exist under Debian.
I downloaded the source and diff for the mpage-2.5.4-1 (ie
mpage_2.5.4.orig.tar.gz and mpage_2.5.4-1.diff.gz) and discovered that
while the Debian diff had two places where it replaced /usr/tmp/ with
/tmp/, there were an additional two places (within file.c) which was not
patched.
I have included an updated unified diff for mpage-2.5.4 that will cleanly
apply to "file.c". Note that one of the replacements of
/usr/tmp/mpageXXXXXX by /tmp/mpageXXXXXX is not actually needed as it is
currently situated in a cpp-#defined-away code. But I thought it'd be nice
to fix it as well.
Regards
Eddie
--- mpage-2.5.4.orig/file.c
+++ mpage-2.5.4/file.c
@@ -168,7 +168,7 @@
* but the tmpfilename
*/
- (void) strcpy(tmpfile, "/usr/tmp/mpage-stdin-XXXXXX");
+ (void) strcpy(tmpfile, "/tmp/mpage-stdin-XXXXXX");
if ( (tmpfd = mkstemp(tmpfile)) == -1) {
fprintf(stderr, "%s: cannot create temporary file", MPAGE);
perror(MPAGE);
@@ -209,7 +209,7 @@
* a temporary file; this temporary file will then
* be used as input to the do_doc routine
*/
- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX");
+ (void)strcpy(tmpfile, "/tmp/mpageXXXXXX");
if ( (tmpfd = mkstemp(tmpfile)) == -1) {
fprintf(stderr, "%s: cannot create temporary file", MPAGE);
perror(MPAGE);
@@ -280,7 +280,7 @@
/*
* store the input to the temporary file to guess encoding correctly
*/
- (void)strcpy(tmpfile, "/usr/tmp/mpageXXXXXX");
+ (void)strcpy(tmpfile, "/tmp/mpageXXXXXX");
if ( (tmpfd = mkstemp(tmpfile)) == -1) {
fprintf(stderr, "%s: cannot create temporary file", MPAGE);
tmpfile[0] = 0;
@@ -362,7 +362,7 @@
Debug(DB_STDIN, "%%iswanted: opt_first[i]: %d\n", opt_first[i]);
Debug(DB_STDIN, "%%iswanted: opt_alt[i]: %d\n", opt_alt[i]);
Debug(DB_STDIN, "%%iswanted: opt_last[i]: %d\n", opt_last[i]);
- if ((sn >= opt_first[i] && (opt_alt[i] <= 1 || (sn - opt_first[i]) %
opt_alt[i] == 0) ) &&
+ if ((sn >= opt_first[i]) && ((sn - opt_first[i]) % opt_alt[i] == 0) &&
(sn <= opt_last[i])) {
Debug(DB_STDIN, "%%iswanted: wanted page %d\n", sn);
ps_outpages++;