It's been a few years since I've used tup with latex (sadly; got too hard
to support other os x users/collaborators), but circa 2019 it worked fine.

I'm surprised you are seeing multiple reads to test.tex from one invocation
of pdftex, at least with pdflatex as a driver, you have to explicitly call
the command multiple times. Tup isn't okay with multiple build rules
modifying the same output file, so you have to have one single tup command
do all of the (la)tex driver invocations, i.e., here's the relevant snippet
from a paper from 2016:

: paper.tex | ../figs/<figsgroup> ../images/<imagesgroup> *.cls *.bib |> \
^ pdflatex ^ \
pdflatex -jobname=@(PAPER_NAME) %f; bibtex @(PAPER_NAME); pdflatex
-jobname=@(PAPER_NAME) %f; pdflatex -jobname=@(PAPER_NAME) %f  |> \
@(PAPER_NAME).pdf | @(PAPER_NAME).aux @(PAPER_NAME).bbl @(PAPER_NAME).blg
@(PAPER_NAME).log @(PAPER_NAME).out


Later on, we moved to a wrapper-driver
<https://github.com/aclements/latexrun> which more intelligently knew how
to run the latex driver "enough" times (but, critically, was still one
command from tup's perspective:

: paper.tex | ../figs/<figsgroup> ../images/<imagesgroup> *.cls *.bib |> \
^ pdflatex ^ ../support/latexrun.py --latex-args="-shell-escape" -Wall -o
@(PAPER_NAME).pdf -O ./ %f |> \
@(PAPER_NAME).pdf | paper.aux paper.bbl paper.blg paper.dep paper.log
paper.out paper.fls paper.pdf latexrun.db latexrun.db.lock paper.dft


HTH,

-Pat

On Wed, Jul 16, 2025 at 2:15 AM Sanjoy Mahajan <[email protected]> wrote:

> On 2025-07-15 17:25, Sanjoy Mahajan <[email protected]> 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
>
> --
> --
> tup-users mailing list
> email: [email protected]
> unsubscribe: [email protected]
> options: http://groups.google.com/group/tup-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "tup-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/tup-users/87v7ns339h.fsf%40mit.edu.
>

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/tup-users/CAAnLKaF%3DG7v4rZRxzs_Mjgy1P%2BPQb-kYvJQx57%3DGGaU%3D0nLyFA%40mail.gmail.com.

Reply via email to