Fedora Account System
Red Hat Associate
Red Hat Customer
Created attachment 1278076 [details] Example file The /usr/share/doc/roundcubemail/README.rpm text file is attached. This is what I get: $ rpm -qp /tmp/README.rpm error: open of Additional failed: No such file or directory error: open of installation failed: No such file or directory error: open of and failed: No such file or directory error: open of update failed: No such file or directory error: open of information: failed: No such file or directory error: open of Upstream failed: No such file or directory error: open of documentation: failed: No such file or directory ^Cerror: open of http://trac.roundcube.net/wiki failed: Interrupted system call error: open of Notice failed: No such file or directory ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^Z [2]+ Stopped rpm -qp /tmp/README.rpm $ killall -9 rpm [2]+ Killed rpm -qp /tmp/README.rpm Seems like rpm is also trying to reach internet? +++ This bug was initially created as a clone of Bug #1449790 +++ +++ This bug was initially created as a clone of Bug #1449517 +++
Well, works as intended ... ehm ... may be ... RPM allows passing manifest files at the command line. These files are supposed to contain file names of packages or other manifest files. So rpm tries to open all these "file names". As far as I can see it does not try to access the internet but tries to open the URL as a file name (and fails). There seems to be an issue with rpm treating the "-" from the file as stdin. This results in rpm waiting for the user to type in more package names. Removing all the standalone "-" signs makes rpm go through the file without stopping. Upstream has a few more checks in place now rejecting the file right away. There also is some code to not open stdin on encountering "-".
> As far as I can see it does not try to access the internet but tries to open > the URL as a file name (and fails). $ strace -e execve -f rpm -qp /tmp/README.rpm .... strace: Process 31757 attached [pid 31757] execve("/usr/bin/curl", ["/usr/bin/curl", "--silent", "--show-error", "--fail", "--globoff", "--location", "-o", "/var/tmp/rpm-tmp.lQSoq1", "http://trac.roundcube.net/wiki"], [/* 90 vars */]) = 0 .... strace: Process 31760 attached [pid 31760] execve("/usr/bin/curl", ["/usr/bin/curl", "--silent", "--show-error", "--fail", "--globoff", "--location", "-o", "/var/tmp/rpm-tmp.rhKYfQ", "http://trac.roundcube.net/wiki"], [/* 90 vars */]) = 0 .... > Upstream has a few more checks in place now rejecting the file right > away. There also is some code to not open stdin on encountering "-". Ok, good to know. What is your suggestion for the 'less' (bug 1449790) issue? Can I detect (without file) that "README.rpm" is manifest file, and open the file as text file (without using file)? Thanks!
I think this is the wrong question. The manifest files are not supposed to end with .rpm. So the issue here is not detecting manifest files names *.rpm but detecting any improper files named *.rpm. There has been a lot of work improving file checks upstream (by Panu mostly). Proper manifest files can and should end with .txt or something like that. So they already should be listed correctly. So the right answer here is rpm becoming more robust when being passed garbage. This is something happening right now. Wrt less: Using file instead of the ending alone would make things more robust. There is no real way around that other that reimplementing the check used by file: looking for the magic bytes at the beginning of an rpm package.
> Proper manifest files can and should end with .txt or something like that. So > they already should be listed correctly. Ah, OK. Then it should be safe to do 'rpm -qp --nomanifest', do I get it right?
yes.