Bug 157308 - getextattr(8) incorrect listing of attibutes with glob on whole directory.
Summary: getextattr(8) incorrect listing of attibutes with glob on whole directory.
Status: Closed Unable to Reproduce
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alan Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 04:50 UTC by jhell
Modified: 2016-06-21 15:29 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jhell 2011-05-25 04:50:06 UTC
Invoking getextattr(8) on a glob pattern that matches the whole contents of a directory or possibly even a smaller part of the contents display incorrect attributes other than what was set.

Invoking getextattr(8) on a single file results in correctly displaying the value.

To rule out possible flukes of nature and scripting I copied the explained below 'bin' directory to a seperate filesystem and removed '[' all 'symlinks' and 'direct links' so all that was left were actual files that were only single copies of themself and the situation still repeated across multiple machines.

This was tested with '/rescue' '/bin' '/sbin' with the same results.

Fix: 

Unknown at this time 'WIP'
How-To-Repeat: Set the attributes using short example script here via (root):
--------------------------------------------------
#!/bin/sh
for file in /bin/*; do
    setextattr system NAME `basename $file` $file
done
--------------------------------------------------

Then ensure the attributes are set (should show 'NAME' for every file)
lsextattr system /bin/*

Then display single correct name (should show 'realpath')
getextattr system NAME /bin/realpath

Then display list of incorrect names. (Starts displaying incorrectly for larger name than the previously displayed name)(Notice realpath displays as 'realpathmeme')
getextattr system NAME /bin/*

Bad output:
./[     ./test
./bash  ./bash
./cat   ./cath
./chflags       ./chflags
./chio  ./chioags
./chmod ./chmodgs
./cp    ./cpmodgs
./csh   ./tcshdgs
./date  ./datedgs
./dd    ./ddtedgs
./df    ./dftedgs
./domainname    ./domainname
./echo  ./echoinname
./ed    ./redoinname
./expr  ./exprinname
./getfacl       ./getfaclame
./hostname      ./hostnameme
./kenv  ./kenvnameme
./kill  ./killnameme
./ksh   ./ksh93ameme
./ksh93 ./ksh93ameme
./link  ./lnh93ameme
./ln    ./lnh93ameme
./ls    ./lsh93ameme
./mkdir ./mkdirameme
./mv    ./mvdirameme
./pax   ./paxirameme
./pgrep ./pkillameme
./pkill ./pkillameme
./ps    ./psillameme
./pwait ./pwaitameme
./pwd   ./pwditameme
./rcp   ./rcpitameme
./realpath      realpathmeme
./red   ./redathmeme
./rm    ./unlinkmeme
./rmail ./rmailkmeme
./rmdir ./rmdirkmeme
./setfacl       ./setfacleme
./sh    ./shtfacleme
./sleep ./sleepcleme
./stty  ./sttypcleme
./sync  ./syncpcleme
./tcsh  ./tcshpcleme
./test  ./testpcleme
./unlink        ./unlinkleme
./uuidgen       ./uuidgeneme
Comment 1 Alan Somers freebsd_committer freebsd_triage 2016-06-06 14:52:54 UTC
I cannot reproduce this bug on a recent HEAD, using either the current getextattr or a getextattr built from the sources as of 2011-05-25.  jhell, can you still reproduce it?
Comment 2 Alan Somers freebsd_committer freebsd_triage 2016-06-21 15:29:25 UTC
This bug is five years old, not reproducible, and there's been no feedback from the reporter for 2 weeks.  So I'm closing it.