This is the mail archive of the
mailing list for the elfutils project.
[Bug general/21009] Incompatible with MUSL libc: canonicalize_file_name
- From: "mjw at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Sat, 31 Dec 2016 15:36:21 +0000
- Subject: [Bug general/21009] Incompatible with MUSL libc: canonicalize_file_name
- Auto-submitted: auto-generated
- References: <firstname.lastname@example.org/bugzilla/>
Mark Wielaard <mjw at redhat dot com> changed:
What |Removed |Added
CC| |mjw at redhat dot com
--- Comment #1 from Mark Wielaard <mjw at redhat dot com> ---
(In reply to Luiz Angelo Daros de Luca from comment #0)
> However, there seems to be some limitation on realpath:
I assume that refers to this:
The POSIX.1-2001 standard version of this function is broken by design,
since it is impossible to determine a suitable size for the output
buffer, resolved_path. According to POSIX.1-2001 a buffer of size
PATH_MAX suffices, but PATH_MAX need not be a defined constant, and may
have to be obtained using pathconf(3). And asking pathconf(3) does not
really help, since, on the one hand POSIX warns that the result of
pathconf(3) may be huge and unsuitable for mallocing memory, and on the
other hand pathconf(3) may return -1 to signify that PATH_MAX is not
bounded. The resolved_path == NULL feature, not standardized in
POSIX.1-2001, but standardized in POSIX.1-2008, allows this design
problem to be avoided.
Even old glibc versions (at least 2.5+) implemented the resolved_path == NULL
feature. So I think we can assume any recent glibc alternative also has this.
> If autoconf checks for it, we could simply define a macro for it when
> canonicalize_file_name is not present like:
> #ifndef HAVE_canonicalize_file_name
> #define canonicalize_file_name(name) realpath(name,NULL)
> This function is used only at:
> And both include system.h. So, the best place to conditionally define it
> might be system.h.
> What's the correct approach? change the call or conditionally define a new
I think we can assume everybody uses glibc or a modern alternative that already
implements the resolved_path == NULL feature. So I would simply change the two
callers of canonicalize_file_name (name) to realpath (name, NULL).
You are receiving this mail because:
You are on the CC list for the bug.