pdfbeads icon indicating copy to clipboard operation
pdfbeads copied to clipboard

pdfbeads writes temporary files to $PWD instead of $TMPDIR

Open stapelberg opened this issue 9 years ago • 0 comments

This is a problem when running pdfbeads with $PWD on a different file system (e.g. /home on persistent storage such as an SSD) than the input files (e.g. /tmp, a tmpfs), as one cannot rename() across file systems.

From strace:

25941 17:33:06.878084 write(2, "JBIG2 compression complete. page"..., 57) = 57
25941 17:33:06.885496 open("output.sym", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
25941 17:33:06.885548 write(3, "\0\0\0\0\0\1\0\0\0=\265\0\0\3\377\375\377\2\376\376\376\0\0\2`\0\0\2`\224ku"..., 15808) = 15808
25941 17:33:06.885572 close(3)          = 0
25941 17:33:06.891936 open("output.0000", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
25941 17:33:06.891964 write(3, "\0\0\0\0010\0\1\0\0\0\23\0\0\23`\0\0\33h\0\0\2X\0\0\2X\0\0\0\0\0"..., 11882) = 11882
25941 17:33:06.891982 close(3)          = 0
25941 17:33:06.896424 open("output.0001", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
25941 17:33:06.896450 write(3, "\0\0\0\0040\0\1\0\0\0\23\0\0\23`\0\0\33h\0\0\2X\0\0\2X\0\0\0\0\0"..., 11411) = 11411
25941 17:33:06.896467 close(3)          = 0
25941 17:33:06.900355 open("output.0002", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
25941 17:33:06.900378 write(3, "\0\0\0\0070\0\1\0\0\0\23\0\0\23`\0\0\33h\0\0\2X\0\0\2X\0\0\0\0\0"..., 9407) = 9407
25941 17:33:06.900394 close(3)          = 0
25941 17:33:06.903054 open("output.0003", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
25941 17:33:06.903076 write(3, "\0\0\0\n0\0\1\0\0\0\23\0\0\23`\0\0\33h\0\0\2X\0\0\2X\0\0\0\0\0"..., 7657) = 7657
25941 17:33:06.903092 close(3)          = 0
25941 17:33:06.903534 brk(0x1a66000)    = 0x1a66000
25941 17:33:06.904021 exit_group(0)     = ?
25938 17:33:06.904466 <... read resumed> "", 8192) = 0
25941 17:33:06.904473 +++ exited with 0 +++
25938 17:33:06.904477 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=25941, si_uid=1000, si_status=0, si_utime=15, si_stime=0} ---
25938 17:33:06.904498 close(7)          = 0
25938 17:33:06.904518 wait4(25941, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 25941
25938 17:33:06.904559 stat("output.0000", {st_dev=makedev(252, 0), st_ino=1189346, st_mode=S_IFREG|0600, st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=24, st_size=11882, st_atime=2016/04/03-17:28:27, st_mtime=2016/04/03-17:33:06, st_ctime=2016/04/03-17:33:06}) = 0
25938 17:33:06.904608 rename("output.0000", "/tmp/scand-convert606000674/page0.jbig2") = -1 EXDEV (Invalid cross-device link)

Instead of the current working directory, scratch files should be stored in https://en.wikipedia.org/wiki/TMPDIR

stapelberg avatar Apr 03 '16 15:04 stapelberg