On Wed, May 02, 2018 at 05:32:25PM +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 ?
Hmm, another idea - if the problem is that we can't easily mock
canonicalize_file_name() why don't we just provide a trivial
wrapper. eg virFileCanonicalize() which does nothing except
call canonicalize_file_name(). We can then just mock the
virFileCanonicalize() method instead. This would nicely avoid
the pain with dealing with versioned symbols for realpath too.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|