Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 23087 - fowners does not handle wildcards correctly
Summary: fowners does not handle wildcards correctly
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-19 02:10 UTC by Thomas Eckert
Modified: 2011-10-30 22:17 UTC (History)
0 users

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


Attachments
fowners hacked (fowners.tom,603 bytes, text/plain)
2004-04-12 06:10 UTC, Thomas Eckert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Eckert 2003-06-19 02:10:30 UTC
if using fowners with wildcards like
  fowners nobody:nobody /my/dir/*
the "*" expansion is performed on the real "/" (ignoring ${D}).


Reproducible: Always
Steps to Reproduce:

Actual Results:  
fowners call to chown fails with "no such file or directory"

Expected Results:  
should set the ownership and handle $D correctly

FIX:
in /usr/lib/portage/bin/fowners
change ^for.* to
for FILE in ${D}$*; do
Comment 1 Thomas Eckert 2003-06-19 02:17:05 UTC
addition to the fix:
${D} has to be removed from the chown-line of course.
Comment 2 Thomas Eckert 2003-06-28 10:37:20 UTC
I figured out that my fix-suggestion was not complete: it only works for _one_
file-parameter. One solution would be to test for _exactly 2_ parameters in fowners.
Maybe disabling filename-expansion temporarily with "set -f" offers an other solution (with 2 nested loops)?
Comment 3 Andrew Cooks (RETIRED) gentoo-dev 2003-11-26 01:19:07 UTC
Any progress or feedback on this?
Comment 4 Thomas Eckert 2004-04-12 06:10:25 UTC
Created attachment 29141 [details]
fowners hacked

finally the activation energy was high enough to dig into this a bit deeper ...


note:
To realize it in pure bash (no fork) 2 temporary vars are needed (the names
choosen are rather long to be self-expanatory). Filenames with spaces are
handled
correctly.
The "ERROR"-message should be removed later on as fowners should be used like
  fowners user:group f1 f2 d1/f3 || die
in ebuilds.

If this version is going to make it into portage: fperms should be modified
the same way.
Comment 5 Thomas Eckert 2004-04-12 06:21:26 UTC
*grr* correction:
it should read: filenames with spaces are NOT handled correctly.
I think that is a minor problem (nevertheless a problem).
Comment 6 Nicholas Jones (RETIRED) gentoo-dev 2004-04-12 15:23:07 UTC
eval is bad.
You can't really fix globs like that without a lot of work.

Best solution is to not add ${D} if it's already there.
Comment 7 Aron Griffis (RETIRED) gentoo-dev 2005-06-28 11:29:29 UTC
Handling wildcards isn't going to happen.  That's a bash thing.  They're
expanded before fowners is even called.  Ebuild writers just have to be smarter
than that.

For the other stuff, see bug 97324