Skip to content

testsuite: interpose the large-file spellings of open/openat/fstatat - #1063

Merged
steadytao merged 1 commit into
RsyncProject:masterfrom
samueloph:testsuite-interpose-lfs-symbols
Aug 19, 2026
Merged

testsuite: interpose the large-file spellings of open/openat/fstatat#1063
steadytao merged 1 commit into
RsyncProject:masterfrom
samueloph:testsuite-interpose-lfs-symbols

Conversation

@samueloph

Copy link
Copy Markdown
Member

Which symbol names this test's LD_PRELOAD hook exports is decided by the compiler that builds it, and which names rsync imports is decided by configure -- and the two do not have to agree.

Where off_t is not already 64 bits, configure's AC_SYS_LARGEFILE adds -D_FILE_OFFSET_BITS=64 (i386 and alpha in Debian), so glibc redirects every open()/openat()/fstatat() call in rsync to open64(), openat64() and fstatat64(). The hook is compiled by a bare "cc", so on those architectures it defines only the unsuffixed names: the receiver's opens never reach it, no EACCES is injected, the marker the positive control looks for is never written, and the test fails with

positive control failed: receiver did not open the existing partial file
with O_CREAT (rc=0, output='')

It happens to work on Debian's 64-bit time_t ports (armhf, hppa, powerpc, ...) only by luck: their gcc predefines -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64, so glibc's __REDIRECT renames the hook's own DEFINITIONS as well and it ends up exporting exactly the *64 names rsync imports.

Define both spellings explicitly so the hook interposes whichever set the rsync under test was linked against, and #undef the two macros at the top of the hook so that renaming cannot happen -- otherwise, on precisely those ports whose compiler predefines them, open() would be emitted as open64() and collide with the explicit wrapper ("symbol `open64' is already defined"), leaving the hook unbuildable and the test skipped.

The new pointers are resolved through hook_resolve(), so the existing nested-dlsym recursion guard covers them as well.

Failing build logs:
i386 https://buildd.debian.org/status/fetch.php?pkg=rsync&arch=i386&ver=3.5.0%2Bds1-1&stamp=1786938290&raw=0
alpha https://buildd.debian.org/status/fetch.php?pkg=rsync&arch=alpha&ver=3.5.0%2Bds1-1&stamp=1786973432&raw=0

Which symbol names this test's LD_PRELOAD hook exports is decided by the
compiler that builds it, and which names rsync imports is decided by
configure -- and the two do not have to agree.
Where off_t is not already 64 bits, configure's AC_SYS_LARGEFILE adds
-D_FILE_OFFSET_BITS=64 (i386 and alpha in Debian), so glibc redirects every
open()/openat()/fstatat() call in rsync to open64(), openat64() and
fstatat64(). The hook is compiled by a bare "cc", so on those architectures
it defines only the unsuffixed names: the receiver's opens never reach it, no
EACCES is injected, the marker the positive control looks for is never
written, and the test fails with
positive control failed: receiver did not open the existing partial file
with O_CREAT (rc=0, output='')
It happens to work on Debian's 64-bit time_t ports (armhf, hppa, powerpc,
...) only by luck: their gcc predefines -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64,
so glibc's __REDIRECT renames the hook's own DEFINITIONS as well and it ends
up exporting exactly the *64 names rsync imports.
Define both spellings explicitly so the hook interposes whichever set the
rsync under test was linked against, and #undef the two macros at the top of
the hook so that renaming cannot happen -- otherwise, on precisely those ports
whose compiler predefines them, open() would be emitted as open64() and
collide with the explicit wrapper ("symbol `open64' is already defined"),
leaving the hook unbuildable and the test skipped.
The new pointers are resolved through hook_resolve(), so the existing
nested-dlsym recursion guard covers them as well.
Failing build logs:
i386 https://buildd.debian.org/status/fetch.php?pkg=rsync&arch=i386&ver=3.5.0%2Bds1-1&stamp=1786938290&raw=0
alpha https://buildd.debian.org/status/fetch.php?pkg=rsync&arch=alpha&ver=3.5.0%2Bds1-1&stamp=1786973432&raw=0

@steadytaosteadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@steadytao
steadytao merged commit 0145b91 into RsyncProject:masterAug 19, 2026
20 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@samueloph@steadytao