Bug 2108537

Summary: perl-Directory-Queue-2.1-3.fc37 fails tests in mock with BTRFS because number of links to a directory is always 1
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: perl-Directory-QueueAssignee: lionel.cons
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: lionel.cons, massimo.paladin, perl-devel, steve.traylen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://koschei.fedoraproject.org/package/perl-Directory-Queue?collection=f37
Whiteboard:
Fixed In Version: 2.2-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-20 09:04:59 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 Petr Pisar 2022-07-19 08:55:50 UTC
perl-Directory-Queue-2.1-3.fc37 fails in Fedora 37 on ppc64le like this:

t/1main.t ...... ok
#   Failed test 'count 1'
#   at t/1normal.t line 55.
#          got: '-1'
#     expected: '1'
#   Failed test 'count 2'
#   at t/1normal.t line 59.
#          got: '-1'
#     expected: '2'
#   Failed test 'count 1'
#   at t/1normal.t line 74.
#          got: '-1'
#     expected: '1'
#   Failed test 'count 0'
#   at t/1normal.t line 83.
#          got: '-1'
#     expected: '0'
invalid maxelts: -1
# Looks like your test exited with 255 just after 31.
t/1normal.t .... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 22/49 subtests 

A difference between passing and failing build root is at <https://koschei.fedoraproject.org/build/13217496>.

This failure happens on pcc64le in mock. It does not happen outside mock or on F35 x86_64 in mock with F37 user space.

I located the problem to Directory::Queue::Normal->count() which always return -1. That's because _subdirs_stat() returns "$stat[ST_NLINK] - 2" where $stat[ST_NLINK] is 1. It looks like something has changed in kernel, glibc, or mock and as a result i-nodes of directories inside mock /tmp/ (as well as root) filesystem are not "properly" counted:

# ls -la /tmp/a/
total 0
drwxr-xr-x. 1 root root  2 Jul 19 04:53 .
drwxrwxrwt. 1 root root 14 Jul 19 04:53 ..
drwxr-xr-x. 1 root root  0 Jul 19 04:53 b

# stat /tmp/a
  File: /tmp/a
  Size: 2               Blocks: 0          IO Block: 65536  directory
Device: 0,32    Inode: 164461      Links: 1
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-07-19 04:53:57.610017436 -0400
Modify: 2022-07-19 04:53:53.840139244 -0400
Change: 2022-07-19 04:53:53.840139244 -0400
 Birth: 2022-07-19 04:53:44.220450066 -0400

The number of links is expected to be 3 instead of 1. The number does not changes when creating additional subdirectories in /tmp/a.

Comment 1 Petr Pisar 2022-07-19 08:59:38 UTC
The underlying file system is BTRFS.

Comment 2 lionel.cons 2022-07-19 09:58:31 UTC
This should be fixed in the just released 2.2 upstream version.

Comment 3 Petr Pisar 2022-07-19 10:33:19 UTC
Great. This is indeed triggered by the file system <https://linux-btrfs.vger.kernel.narkive.com/oAoDX89D/btrfs-st-nlink-for-directories#post3>. Probably mock or its configuration has moved to btrfs in Koji build system.

Comment 4 Petr Pisar 2022-07-19 10:35:19 UTC
It worked without mock because then /tmp is tmpfs.

Comment 5 lionel.cons 2022-07-20 08:46:33 UTC
2.2 has now been released, see https://bodhi.fedoraproject.org/updates/FEDORA-2022-d7ab7afb02

OK to close this bug?

Comment 6 Petr Pisar 2022-07-20 09:01:19 UTC
Yes. Please paste the build NVR into Fixed In Version field and close this bug report.