Bug 1982608

Summary: glibc: Fix glob() implementation on XFS [rhel-8.7.0]
Product: Red Hat Enterprise Linux 8 Reporter: Michal Kolar <mkolar>
Component: glibcAssignee: DJ Delorie <dj>
Status: CLOSED ERRATA QA Contact: Martin Coufal <mcoufal>
Severity: unspecified Docs Contact: Jacob Taylor Valdez <jvaldez>
Priority: unspecified    
Version: 8.6CC: ashankar, codonell, dj, fweimer, jvaldez, mcoufal, mnewsome, pfrankli, sipoyare, skolosov
Target Milestone: betaKeywords: Bugfix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.28-200.el8 Doc Type: Bug Fix
Doc Text:
.Wildcard functions in Makefiles no longer return symbolic links when only directories are expected Previously, the `GLOB_ONLYDIR` hint used by `glob()` misreported symbolic links as directories on certain XFS filesystems. When using `glob()`, `make` did not confirm that the hints were actually directories and, as a result, wildcard functions in Makefiles returned symbolic links when only directories were expected. The bug has been fixed and wildcard functions in Makefiles no longer return symbolic links when only directories are expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:43:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Kolar 2021-07-15 09:32:22 UTC
Description of problem:
A new issue was observed in the functions/wildcard of upstream testsuite during regression testing of make.

Version-Release number of selected component (if applicable):
RHEL-7.9
devtoolset-11-make-4.3-1.el7

Steps to Reproduce:
===
yum-builddep -y devtoolset-11-make-4.3-1.el7.src.rpm
rpm -U devtoolset-11-make-4.3-1.el7.src.rpm
rpmbuild -bc ~/rpmbuild/SPECS/make.spec
cd ~/rpmbuild/BUILD/make-4.3/tests/
perl ./run_make_tests.pl -srcdir ../ -make ../make functions/wildcard
===

Actual results:
===
[root@sweetpig-22 tests]# perl ./run_make_tests.pl -srcdir ../ -make ../make functions/wildcard
Opened read-only file! Skipping related tests.
Opened unreadable file!  Skipping related tests.
---------------------------------------------------------------------------------------------------------------
   Running tests for GNU make on Linux sweetpig-22.4a2m.lab.eng.bos.redhat.com 3.10.0-1160.el7.x86_64 x86_64
                                                 GNU Make 4.3
---------------------------------------------------------------------------------------------------------------

Making work dirs...

functions/wildcard ...................................... FAILED (8/10 passed)

2 Tests in 1 Category Failed (See .diff* files in work dir for details) :-(

[root@sweetpig-22 tests]# echo $?
1
[root@sweetpig-22 tests]# cat work/functions/wildcard.diff.*
*** work/functions/wildcard.base.6      Thu Jul 15 05:26:00 2021
--- work/functions/wildcard.log.6       Thu Jul 15 05:26:00 2021
***************
*** 1,13 ****
  hellod hellof
! hellod/
  hellod/worldd hellod/worldf
! hellod/worldd/
  hellod hellof hellod/worldd hellod/worldf
! hellod/ hellod/worldd/
  hellod/worldd hellod/worldf
! hellod/worldd/
  hellod/worldd hellod/worldf
  hellod/worldd/
! hellod/worldd/kend1/ hellod/worldd/kend2/
  hellod/worldd/kend1 hellod/worldd/kend2 hellod/worldd/kenf1 hellod/worldd/kenf2
! hellod/worldd/kend1/ hellod/worldd/kend2/
--- 1,13 ----
  hellod hellof
! hellod/ hellof
  hellod/worldd hellod/worldf
! hellod/worldd/ hellod/worldf
  hellod hellof hellod/worldd hellod/worldf
! hellod/ hellof hellod/worldd/ hellod/worldf
  hellod/worldd hellod/worldf
! hellod/worldd/ hellod/worldf
  hellod/worldd hellod/worldf
  hellod/worldd/
! hellod/worldd/kend1/ hellod/worldd/kend2/ hellod/worldd/kenf1 hellod/worldd/kenf2
  hellod/worldd/kend1 hellod/worldd/kend2 hellod/worldd/kenf1 hellod/worldd/kenf2
! hellod/worldd/kend1/ hellod/worldd/kend2/ hellod/worldd/kenf1 hellod/worldd/kenf2
*** work/functions/wildcard.base.9      Thu Jul 15 05:26:00 2021
--- work/functions/wildcard.log.9       Thu Jul 15 05:26:00 2021
***************
*** 1 ****
! __ldir
--- 1 ----
! 
[root@sweetpig-22 tests]#
===

Expected results:
No failure

Comment 1 DJ Delorie 2021-08-05 03:32:13 UTC
This seems to be due to a limitation on XFS filesystems - the getdents syscall doesn't reliably fill in the entry types.  Running on ext4 or tmpfs filesystems works fine.  It might also be a glibc bug, as glob() relies on these unreliable entry types, and returns mismatched results.

Comment 2 DJ Delorie 2021-08-09 18:39:46 UTC
This has been identified as a glibc bug, see https://sourceware.org/pipermail/libc-alpha/2021-August/129910.html

This bug does not qualify for a fix at 7.9's current point in its lifecycle, moving it to 8.6 for consideration.

Note that as a workaround, using a non-XFS filesystem (such as EXT4) avoids this bug.

Comment 8 DJ Delorie 2022-05-09 18:24:28 UTC
Note that this bug only happens on XFS filesystems that are created with "mkfs.xfs -m crc=0 -n ftype=0 ...". These used to be the defaults, but no longer are.  "man mkfs.xfs" will tell you if crc=1 (which forces ftype=1) is the default for your version.  Setting crc=1 or ftype=1 when creating the filesystem bypasses the bug, but is (for obvious reasons ;) not considered a viable workaround.

Comment 16 errata-xmlrpc 2022-11-08 10:43:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (glibc bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7684