Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 8832 - epm -qf doesn't work without full path
Summary: epm -qf doesn't work without full path
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High trivial (vote)
Assignee: Aron Griffis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-06 22:56 UTC by Bill Gjestvang
Modified: 2003-05-01 22:04 UTC (History)
3 users (show)

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


Attachments
Make "epm -qf relname" work (epm.qf.patch,791 bytes, patch)
2002-12-27 12:40 UTC, Wayne Davison
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Gjestvang 2002-10-06 22:56:49 UTC
"epm -qf" doesn't work unless you prepend the path to the filename.

This can lead people to assume that a file is not owned by any package, when in
fact it is.

Example:
$ cd /etc
$ epm -qf man.conf
file man.conf is not owned by any package
$ epm -qf /etc/man.conf
man-1.5k

Expected behavior:
$ cd /etc
$ epm -qf man.conf
man-1.5k
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-10-18 16:48:50 UTC
This is a deliberate design feature that is contestable. I guess we should at
least add a flag to have it do more lenient searches.
Comment 2 Bill Gjestvang 2002-10-31 20:23:54 UTC
It's definitely different behavior than rpm.
Here's how rpm-4.0.4-7x.18 works on RedHat 7.3:

$ cd /etc
$ rpm -qf man.config
man-1.5j-6

$ cd /
$ rpm -qf man.config
error: file man.config: No such file or directory
$ rpm -qf /etc/man.config
man-1.5j-6
Comment 3 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-11-02 16:13:52 UTC
Another fairly tiny issue. I think epm -qf should do whatever rpm -qf does. Do
you have time to check out how rpm -qf works, and try to imitate it ?
Comment 4 Thomas Raschbacher gentoo-dev 2002-12-01 17:57:16 UTC
hi!

this was no python code... ;)

but cuz of it my perl-skill got an 'upgrade' *G*

greetings, LordVan

here's a diff:

280,282c280,281
<       # TODO: If it's a relative pathname, then figure out
<       #       the full pathname
<       if ($a !~ m#^/#) { }
---
>       ## if no '/' in file-name add one at the beginning to match the regex
later correct
>       if ($a !~ m|/|) { $a="/$a" }
298c297
<               next unless $f eq $a;
---
>               next unless $f =~ / \Q$a\E $ /x;
Comment 5 Wayne Davison 2002-12-27 12:40:29 UTC
Created attachment 6782 [details, diff]
Make "epm -qf relname" work

This patch uses the "Cwd" perl module to figure out the absolute path of a
relative argument (including collapsing ".." elements).
Comment 6 Aron Griffis (RETIRED) gentoo-dev 2003-04-30 22:53:54 UTC
Thanks Wayne for the patch.  It's in the tree now as 0.8.2 along with
your other patches.  I'm sorry these didn't get in for so long; I
never saw them in bugzilla.  If you have further patches I'll get them
in as quick as I can.
Comment 7 Bill Gjestvang 2003-04-30 23:43:34 UTC
epm should first check whether the file exists.

"epm -qf nonexistentfile"
   returns
"file $PWD/nonexistentfile is not owned by any package"
(e.g. in /usr/bin, returns "file /usr/bin/nonexistentfile is not...")

rpm, for a similar request, returns
"error: file nonexistentfile: No such file or directory"

(But the behavior is much improved from before.)
Comment 8 Aron Griffis (RETIRED) gentoo-dev 2003-05-01 22:04:04 UTC
Thanks Bill for the nit pick. ;-)  All fixed in 0.8.3