Skip to content

Conversation

eli-schwartz
Copy link
Contributor

In 2015, the attr/xattr.h header was fully removed from upstream attr.

In 2020, rsync started preferring the standard header, if it exists: #22

But the fix was incomplete. We still looked for the getxattr function in -lattr, and used it if -lattr exists. This was the case even if the system libc was sufficient to provide the needed functions. Result: overlinking to -lattr, if it happened to be installed for any other reason.

checking whether to support extended attributes... Using Linux xattrs
checking for getxattr in -lattr... yes

Instead, use a different autoconf macro that first checks if the function is available for use without any libraries (e.g. it is in libc).

Result:

checking whether to support extended attributes... Using Linux xattrs
checking for library containing getxattr... none required

gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Apr 23, 2025
When USE=xattr is enabled, the configure script checks for -lattr and
attempts to link to it for good luck. It also checks for attr/xattr.h,
but only includes it in an if/elif when sys/xattr.h doesn't exist --
this makes sense, since the former simply #includes the latter and then
emits a #warning telling you to migrate to libc. Presumably, this is
meant as a sort of infinite compatibility thing and "it's fine if you
use --as-needed" in practice.

rsync doesn't actually include any of libattr's non-deprecated headers,
just xattr.h and at runtime libattr.so is not needed despite
automagically detecting it during configure.

Upstream fix for false detection: RsyncProject/rsync#753

Fixes:
```
 * VDB: detected possibly incorrect RDEPEND (net-misc/rsync-3.3.0-r2)
 * sys-apps/attr <
```

No revbump, this package won't be depcleaned anyway so forcing a rebuild
feels pointless.

Signed-off-by: Eli Schwartz <[email protected]>
In 2015, the attr/xattr.h header was fully removed from upstream attr.

In 2020, rsync started preferring the standard header, if it exists:
RsyncProject#22

But the fix was incomplete. We still looked for the getxattr function in
-lattr, and used it if -lattr exists. This was the case even if the
system libc was sufficient to provide the needed functions. Result:
overlinking to -lattr, if it happened to be installed for any other
reason.

```
checking whether to support extended attributes... Using Linux xattrs
checking for getxattr in -lattr... yes
```

Instead, use a different autoconf macro that first checks if the
function is available for use without any libraries (e.g. it is in
libc).

Result:

```
checking whether to support extended attributes... Using Linux xattrs
checking for library containing getxattr... none required
```

Signed-off-by: Eli Schwartz <[email protected]>
@tridge tridge merged commit 0973d0e into RsyncProject:master Aug 23, 2025
4 checks passed
@eli-schwartz eli-schwartz deleted the xattr-libc branch August 24, 2025 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants