This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 12 Sep 2015 11:09:23 +0100
- Subject: Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.
- Authentication-results: sourceware.org; auth=none
- References: <20150911142140 dot GL2631 at redhat dot com> <55F311D2 dot 8050405 at gmail dot com>
On 11 September 2015 at 18:39, Martin Sebor wrote:
> On 09/11/2015 08:21 AM, Jonathan Wakely wrote:
>> Solaris 10 doesn't follow POSIX in accepting a null pointer as the
>> second argument to realpath(), so allocate a buffer for it.
> FWIW, the NULL requirement is new in Issue 7. In Issue 6, the behavior
> is implementation-defined, and before then it was an error. Solaris 10
> claims conformance to SUSv2 and its realpath fails with EINVAL.
> Solaris 11 says it conforms to Issue 6 but according to the man page
> its realpath already implements the Issue 7 requirement.
> I suspect the same problem will come up on other systems so checking
> the POSIX version might be better than testing for each OS.
The problem with doing that is that many BSD systems have supported
passing NULL as an extension long before issue 7, so if we just check
something like _POSIX_VERSION >= 200809L then we can only canonicalize
paths up to PATH_MAX on many systems where the extension is available
but _POSIX_VERSION implies conformance to an older standard.
So maybe we want an autoconf macro saying whether realpath() accepts
NULL, and just hardcode it for the targets known to support it, and
only check _POSIX_VERSION for the unknowns.