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

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

 



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@xxxxxxxxxx>
---

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@xxxxxxxxxx>

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

Michal




[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