[tlbuild] dvi test?
John Hawkinson
jhawk at alum.mit.edu
Wed Feb 2 00:57:09 CET 2022
Karl Berry <karl at freefriends.org> wrote on Tue, 1 Feb 2022
at 18:14:45 EST in <202202012314.211NEj9Q023918 at freefriends.org>:
> Hi Bruno H - I think it's the implementation of ftruncate that is doing
> that lseek, not the xdvi code. I.e., that's how the file is being
> truncated, by seeking backward to the beginning.
Actually not; sorry if I gave that impression.
Looking at the dtruss output (having finally rebooted and turned off System Integrity Protection so I could use it) with my current tree which does the fseek() before the ftruncate(), EINVAL (Err#22) is still returned by lseek() and ftruncate() is never called (because lseek() fails out of the function now).
This happens
lseek(0x6, 0xFFFFFFFFFFFFF7CF, 0x1) = -1 Err#22
right when I step over
-> 1188 if (fseek(target_fp, 0L, SEEK_SET)) {
This is with my code that swaps the order to fseek() first.
I suppose I should look at the trace from when ftruncate is tried first, just to confirm...yes, the ftruncate() call produces the fruncate trace
root at lrr xdvik # dtruss -p 9759
SYSCALL(args) = return
sigreturn(0x16FDFEC08, 0x1E, 0x16E55CDE4DA9944C) = 0 Err#-2
ftruncate(0x6, 0x0, 0x0) = 0 0
and then fseek() call produces the lseek() call:
lseek(0x6, 0xFFFFFFFFFFFFF7CF, 0x1) = -1 Err#22
Of course, this doesn't tell us why that happens. On the other hand, this part of MacOS/Darwin is nominally open source and should be findable on https://opensource.apple.com/releases/ (presumably this is udner xnu, but maybe libc), although I don't see 12.x, which is the current version we're running. That said, the problem existed in the prior version (11.x) which is available.
On the other hand, it seems to point to https://github.com/apple-oss-distributions/Libc/blob/rel/Libc-1439/stdio/FreeBSD/fseek.c which looks not to have updated since 2014 (before this issue was introduced) and does not implement fseek() in terms of lseek(). Maybe I'm not looking in the right place. [...]
Gotta run off to a meeting now.
--
jhawk at alum.mit.edu
John Hawkinson
More information about the tlbuild
mailing list.