[libvirt PATCH] tests: fix stat mocking with Fedora rawhide

Michal Privoznik mprivozn at redhat.com
Thu Oct 29 18:29:27 UTC 2020


On 10/29/20 6:25 PM, Daniel P. Berrangé wrote:
> GLibC has a really complicated way of dealing with the 'stat' function
> historically, which means our mocks in turn have to look at four
> different possible functions to replace, stat, stat64, __xstat,
> __xstat64.
> 
> In Fedora 33 and earlier:
> 
>   - libvirt.so links to __xstat64
>   - libc.so library exports stat, stat64, __xstat, __xstat64
>   - sys/stat.h header exposes stat and __xstat
> 
> In Fedora 34 rawhide:
> 
>   - libvirt.so links to stat64
>   - libc.so library exports stat, stat64, __xstat, __xstat64
>   - sys/stat.h header exposes stat
> 
> Historically we only looked at the exported symbols from libc.so to
> decide which to mock.
> 
> In F34 though we must not consider __xstat / __xstat64 though because
> they only existance for binary compatibility. Newly built binaries
> won't reference them.
> 
> Thus we must introduce a header file check into our logic for deciding
> which symbol to mock. We must ignore the __xstat / __xstat64 symbols
> if they don't appear in the sys/stat.h header, even if they appear
> in libc.so
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
> 
> Validated with this pipeline:
> 
>    https://gitlab.com/berrange/libvirt/-/pipelines/209361200
> 
>   meson.build                | 28 ++++++++++++-----
>   tests/virmockstathelpers.c | 62 ++++++++++++++++++++++----------------
>   2 files changed, 56 insertions(+), 34 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Thanks for taking care of this. You know I tried but my brain was too 
small for this :-)

Michal




More information about the libvir-list mailing list