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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2018-05-02 at 17:32 +0100, 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 !
> 
> 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 ?

The FreeBSD[1] and macOS[2] releases we care about ship a sensible
implementation of realpath(), which explicitly allows passing NULL
as the second parameter.

Not sure about MinGW, but doesn't it ship basically a recompiled
version of glibc? If so, I would expect it to be perfectly fine
too.

I should also note that I've successfully run the test suite, with
these changes applied, on all CI platforms, so we know there's no
Linux distribution we care about shipping an old enough glibc that
wouldn't include a reasonable realpath().

As for the mocking hiding the issue, we end up calling the actual
realpath() at the end of the day, just on a different file... So
I wouldn't expect that to invalidate the results.


[1] https://www.freebsd.org/cgi/man.cgi?query=realpath&apropos=0&sektion=3&manpath=FreeBSD+10.4-RELEASE&arch=default&format=html
[2] https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/realpath.3.html
-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux