Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922642 - sys-libs/glibc: seekdir() unexpected directory stream positioning on 32bit arm
Summary: sys-libs/glibc: seekdir() unexpected directory stream positioning on 32bit arm
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/bugzilla/show_...
Whiteboard:
Keywords:
Depends on:
Blocks: lfs-tracker
  Show dependency tree
 
Reported: 2024-01-21 19:09 UTC by Andreas K. Hüttel
Modified: 2024-01-22 09:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
seekdir test (main.c,744 bytes, text/x-csrc)
2024-01-22 06:53 UTC, Petre Rodan
Details

Note You need to log in before you can comment on or make changes to this bug.
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