When I am using `rpm -qf --root /path/to/rpm/root /some-file`, it works
correctly for all the cases except one.
Here are the correct cases:
1. When `/some-file` belongs to a package inside the provided rpm root, I get
the package name.
2. When `/some-file` does not belong to a package inside the provided rpm root,
I get `file /some-file is not owned by any package` error.
Here is the case when the error message is wrong:
3. Is same as (2) above, plus `/some-file` does not exist on the host (i.e. it
only exists in the rpm root). In this case, I get `error: file /file: No such
file or directory`, which I believe is a bug (because the file actually exists
in rpm root).
Here is a repro
```console
$ mkdir xxx
$ cd xxx
$ rpmdb --root=$PWD --initdb
$ rpm --root=$PWD -qa # To make sure it works
$ touch some-file
$ rpm --root=$PWD -qf /some-file
error: file /some-file: No such file or directory
```
In fact, the file exists (inside rpm root) and I am expecting `file /some-file
is not owned by any package` output from rpm.
I was able to repro this using rpm from Fedora 38 (rpm-4.18.1-3.fc38.x86_64) as
well as one compiled from the today's git (top commit
1bd0f9cd2eb60c30f6076b202942ab8f43c4e41b).
I believe when the file is not found in rpmdb, for some reason it tries to
stat() it, and when doing so, it does not take the value of `--root` into
account.
Note that `rpm --root=/path/to/rpm/root /path/to-rpm/root/some-file` is not
working as expected (always telling that this file does not belong to any RPM,
even if it is).
I will be happy to provide more examples or explain anything, if needed.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2576
You are receiving this because you are subscribed to this thread.
Message ID: ___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint