On 2025-07-15 17:25, Sanjoy Mahajan <
san...@mit.edu> wrote:
> I've also tried stracing but couldn't see why it has gone awry.
On second thought, the strace did reveal a strange behavior. Here is
the first time that test.tex is read from (by pdftex, which is being run
under tup). It is fine. The newfstatat and fstat calls correctly state
that the file contains 49 bytes. Then the read syscall shows these 49
bytes being read in.
825721 access("./test.tex", R_OK) = 0
825721 newfstatat(AT_FDCWD</home/sanjoy/calculus-textbook/Tuptextest>, "./test.tex", {st_dev=makedev(0, 0x53), st_ino=14, st_mode=S_IFREG|0644, st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=8, st_size=49, st_atime=1752591356 /* 2025-07-15T16:55:56.190571542+0200 */, st_atime_nsec=190571542, st_mtime=1752591347 /* 2025-07-15T16:55:47.266565209+0200 */, st_mtime_nsec=266565209, st_ctime=1752591347 /* 2025-07-15T16:55:47.266565209+0200 */, st_ctime_nsec=266565209}, 0) = 0
825721 openat(AT_FDCWD</home/sanjoy/calculus-textbook/Tuptextest>, "./test.tex", O_RDONLY) = 3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>
825721 fstat(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>, {st_dev=makedev(0, 0x53), st_ino=14, st_mode=S_IFREG|0644, st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=8, st_size=49, st_atime=1752591356 /* 2025-07-15T16:55:56.190571542+0200 */, st_atime_nsec=190571542, st_mtime=1752591347 /* 2025-07-15T16:55:47.266565209+0200 */, st_mtime_nsec=266565209, st_ctime=1752591347 /* 2025-07-15T16:55:47.266565209+0200 */, st_ctime_nsec=266565209}) = 0
825721 read(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>, "\\def\\x{\\times}\n\\message{HELLO THERE}\n$2\\x2$\n\\end\n", 4096) = 49
825721 close(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>) = 0
But the second read of test.tex goes awry. It is allegedly from the
same file, at least by name, but this time the file has zero length
(st_size=0) and is owned by user nobody (65534:65534). When this
zero-length file is read in (when the read syscall returns 0) and
nothing else is given to pdftex, then pdftex correctly complains in its
log file about 'End of file on the terminal!'
825721 access("./test.tex", R_OK) = 0
825721 newfstatat(AT_FDCWD</home/sanjoy/calculus-textbook/Tuptextest>, "./test.tex", {st_dev=makedev(0, 0x53), st_ino=14, st_mode=S_IFREG|000, st_nlink=0, st_uid=65534, st_gid=65534, st_blksize=4096, st_blocks=0, st_size=0, st_atime=0, st_atime_nsec=0, st_mtime=0, st_mtime_nsec=0, st_ctime=0, st_ctime_nsec=0}, 0) = 0
825721 openat(AT_FDCWD</home/sanjoy/calculus-textbook/Tuptextest>, "test.tex", O_RDONLY) = 3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>
825721 fstat(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>, {st_dev=makedev(0, 0x53), st_ino=14, st_mode=S_IFREG|000, st_nlink=0, st_uid=65534, st_gid=65534, st_blksize=4096, st_blocks=0, st_size=0, st_atime=0, st_atime_nsec=0, st_mtime=0, st_mtime_nsec=0, st_ctime=0, st_ctime_nsec=0}) = 0
825721 read(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>, "", 4096) = 0
825721 close(3</home/sanjoy/calculus-textbook/Tuptextest/test.tex>) = 0