Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 922642

Summary: sys-libs/glibc: seekdir() unexpected directory stream positioning on 32bit arm
Product: Gentoo Linux Reporter: Andreas K. Hüttel <dilfridge>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: CONFIRMED ---    
Severity: normal CC: petre.rodan, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://sourceware.org/bugzilla/show_bug.cgi?id=31212
See Also: https://bugs.gentoo.org/show_bug.cgi?id=681790
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 471102    
Attachments: seekdir test

Description Andreas K. Hüttel archtester gentoo-dev 2024-01-21 19:09:37 UTC
This is a clone of https://sourceware.org/bugzilla/show_bug.cgi?id=31212

Petre Rodan 2024-01-04 21:53:08 UTC

Created attachment 15284 [details]
seekdir test for armv7

hi there!

my stable branch Gentoo Linux comes with a 32-bit specific patch to glibc 2.37, found here [1] - I guess the offending patch is the one that modifies sysdeps/unix/sysv/linux/seekdir.c to add the _DIRENT_OFFSET_TRANSLATION ifdef block.

I have attached a sample test which I run on my armv7. the output reads:

 ./main
 pre:           . .. clockevents platform w1 serio iio gpio event_source mdio_bus soc cpu mmc scsi mmc_rpmb spi clocksource hid dp-aux usb serial serial-base
cec sdio genpd nvmem gadget workqueue virtio container i2c mipi-dsi
 s0 location:  4294967295
 s0 entries:
 rew location: 1
 rew entries:   . .. clockevents platform w1 serio iio gpio event_source mdio_bus soc cpu mmc scsi mmc_rpmb spi clocksource hid dp-aux usb serial serial-base
cec sdio genpd nvmem gadget workqueue virtio container i2c mipi-dsi

as you can see, seekdir(dp, 0) leaves the location at an invalid -1 value
while rewinddir(dp) works correctly.
I guess that patch is already part of the glibc repo, so can you reproduce the problem on an armv7?

running the test program on an amd64 Gentoo that contains the same patches returns a perfect output.

thanks,
peter

[1] https://gitweb.gentoo.org/proj/toolchain/glibc-patches.git/tree/9999/0005-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
Comment 1 Petre Rodan 2024-01-22 06:53:47 UTC
Created attachment 882813 [details]
seekdir test

copy of the test attached here as well