[libvirt] [PATCH v2 3/8] all: Use realpath() instead of canonicalize_file_name()

Pino Toscano ptoscano at redhat.com
Wed May 2 16:53:20 UTC 2018


On Wednesday, 2 May 2018 18:32:25 CEST Daniel P. Berrangé wrote:
> On Mon, Apr 30, 2018 at 06:52:58PM +0200, Andrea Bolognani wrote:
> > The latter is a glibc extension that's not available on other
> > operating systems, notably FreeBSD.
> > 
> > So far we have worked around the issue through gnulib, but that
> > makes it difficult to use mocking in our test suite, so just
> > drop it in favor of the portable alternative.
> 
> Sigh, unfortunately realpath() has its own portability problems
> in that passing NULL as second arg was a glibc invention, which
> is why we switched from realpath() to canonicalize_file_name()
> in the first place !

It was, but then this behaviour was standardized in POSIX 2007:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

> So I wonder if this actually works on OS-X, Mingw and FreeBSD,
> or whether you didn't see the bug because it is mocked in the
> tests ?

Most probably because they implement the realpath(.., NULL) semantics,
as described by POSIX.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180502/f425a08d/attachment-0001.sig>


More information about the libvir-list mailing list