Bug 1663619
Summary: | dnf builddep fails on glibc.spec | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | John Reiser <jreiser> | ||||
Component: | dnf-plugins-core | Assignee: | Marek Blaha <mblaha> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 30 | CC: | dmach, jmracek, mblaha, mhatina, mihai, packaging-team-maint, pkratoch, pmatilai, pmoravco, rpm-software-management, vmukhame | ||||
Target Milestone: | --- | Keywords: | Reopened, Triaged | ||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | dnf-plugins-core-4.0.9-1.fc30 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2019-09-06 12:31:08 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
John Reiser
2019-01-05 15:29:17 UTC
Created attachment 1518665 [details]
strace of files accessed by "sudo dnf builddep glibc.spec"
$ dnf builddep glibc.spec
Error: This command has to be run under the root user.
$ sudo strace -f -o strace.out -e trace=file dnf builddep glibc.spec
[sudo] password for jreiser:
Last metadata expiration check: 0:52:22 ago on Sat 05 Jan 2019 06:40:21 AM PST.
Failed to open: 'glibc.spec', not a valid spec file: can't parse specfile
Error: Some packages could not be found.
$
Then strace.out shows many ENOENT for files "/root/rpmbuild/...". Why not look at the login account, too:
# set | grep jreiser ## 'bash' shell during 'sudo'
LOGNAME=jreiser
MAIL=/var/spool/mail/jreiser
PWD=/path/to/rpmbuild/SPECS
SUDO_USER=jreiser
USER=jreiser
USERNAME=jreiser
$
I have clean install f28, download src.rpm from: http://ftp.up.pt/fedora/updates/28/Everything/SRPMS/Packages/g/glibc-2.27-37.fc28.src.rpm create similar file in $HOME/.rpmmacros, executed "steps to reproduce" and command: sudo dnf builddep glibc.spec works without any problem. *** This bug has been marked as a duplicate of bug 1547897 *** Re-open to status 'Assigned' and Version: Fedora 29 because the problem persists; the indicated fix in bug 1547897 comment #8 does not work in Fedora 29. The indicated fix is: "dnf-plugins-core-3.0.1-1 that was released into rawhide." However, I have reproduced the original problem of this bug 1663619 using an updated Fedora 29 with: ===== $ rpm -qa | sort | grep dnf dnf-4.0.9-2.fc29.noarch dnf-data-4.0.9-2.fc29.noarch dnf-plugins-core-4.0.2-1.fc29.noarch dnf-yum-4.0.9-2.fc29.noarch libdnf-0.22.3-1.fc29.x86_64 python3-dnf-4.0.9-2.fc29.noarch python3-dnf-plugins-core-4.0.2-1.fc29.noarch python3-libdnf-0.22.3-1.fc29.x86_64 ===== and: rpm-4.14.2.1-2.fc29.x86_64 redhat-rpm-config-118-1.fc29.noarch. The relevant sha256sum are: 0e466ac218153d5d134702ddf2b0af8b9815603d5937b6bd201a77fc75f04083 glibc-2.27-37.fc28.src.rpm 0f28469429a1d1ae529d7833df76cc5432e96299408aaa77023ab1fdad64a487 glibc.spec The exact error message is: ===== $ pwd /home/jreiser/rpmbuild/SPECS $ ls -l glibc.spec -rw-r--r--. 1 jreiser jreiser 107525 Dec 13 18:55 glibc.spec $ sha256sum glibc.spec 0f28469429a1d1ae529d7833df76cc5432e96299408aaa77023ab1fdad64a487 glibc.spec $ sudo dnf builddep glibc.spec Last metadata expiration check: 0:20:38 ago on Mon 14 Jan 2019 08:20:38 AM PST. Failed to open: 'glibc.spec', not a valid spec file: can't parse specfile Error: Some packages could not be found. $ ===== dnf-plugins-core-4.0.2-1.fc29.noarch is a version higher than dnf-plugins-core-3.0.1-1, so Fedora 29 should contain the same-or-better fix as claimed in bug 1547897. Hmm, missed the fact that bug 1547897 was allegedly fixed already. The comments there indicate that the actual message can now be found from /var/log/dnf.rpm.log, but that's hardly helpful, nobody is going to look there. The error message is directed at the user and should be presented on the terminal. Still fails in Fedora 30: change the Version of this bugzilla report from 29 to 30. Also, there is another bug, which is arguably a root cause of the problem: the lua script does not handle EUID (effective user ID) correctly for "dnf builddep". This is seen in: ===== /var/log/dnf.rpm.log error: lua script failed: [string "<lua>"]:10: cannot open file '/root/rpmbuild/SOURCES/SUPPORTED' (No such file or directory) error: line 500: %{lua: -- Array of languages (ISO-639 codes). ===== Notice the filename '/root/rpmbuild/..." which should be "$HOME/rpmbuild/..." for the $USER who invoked "dnf builddep". Because "dnf builddep" must be run as root, then the UID (which is 0) is no longer the correct UID to use. Instead use SUDO_UID of /bin/bash, as shown by: ===== $ /bin/bash -c set | grep UID EUID=1000 UID=1000 $ sudo /bin/bash -c set | grep UID EUID=0 SUDO_UID=1000 UID=0 $ ===== Or, perhaps the lua script should access %_topdir, which in this case is given by: ===== $HOME/.rpmmacros: %packager %(echo $USER) %_topdir %(echo /home/jreiser/rpmbuild) ===== One possibility for a better separation of privileges: revamp so that the invocation is: sudo dnf install $(dnf list-builddep foo.spec) where the inner "dnf list-builddep foo.spec" merely generates the list of .rpms which are required by foo.spec but not yet installed. Generating the list can be done without superuser privileges. FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, dnf-plugins-extras-4.0.5-1.fc30, libdnf-0.35.2-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc There was a comment (see below) from jreiser on the update to Fedora 30: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc Based on the comment, the bug is not completely fixed, so I am moving this back to ASSIGNED. === comment from jreiser on Fedora 30 update === There has been some improvement for #1663619 "dnf builddep fails on glibc.spec": I can figure out what the problem is from the error messages. The deep error messages from inner subsystems that formerly were hidden now are visible. However the original problem remains: "sudo dnf builddep glibc.spec" fails. The root cause is a mistake in the DESIGN of dnf commands. The user-level command should be "sudo dnf install $(dnf list-builddep glibc.spec)" where the inner "dnf list-builddep" is a read-only operation that does not need superuser privilege: just list the .rpm that are missing for the build. Then the outer "sudo dnf install" installs those .rpm. This is the simplest fix for the problem that lua does the wrong thing: $ sudo dnf builddep glibc.spec [sudo] password for $USER: Last metadata expiration check: 0:05:05 ago on Fri 16 Aug 2019 09:37:02 PM PDT. RPM: error: lua script failed: [string "<lua>"]:10: cannot open file '/root/rpmbuild/SOURCES/SUPPORTED' (No such file or directory) RPM: error: line 508: %{lua: <<snip about 80 lines of lua code>> RPM: end RPM: } RPM: Failed to open: 'glibc.spec', not a valid spec file: can't parse specfile Error: Some packages could not be found. $ Notice the pathname '/root/rpmbuild/SOURCES/SUPPORTED' which begins with '/root'. lua should not be trying to read that file. That was done with: $ rpm -qa | grep dnf | sort *dnf-4.2.8-1.fc30.noarch dnf-data-4.2.8-1.fc30.noarch *dnf-plugins-core-4.0.9-1.fc30.noarch dnf-yum-4.2.8-1.fc30.noarch *libdnf-0.35.2-1.fc30.x86_64 python3-dnf-4.2.8-1.fc30.noarch python3-dnf-plugins-core-4.0.9-1.fc30.noarch python3-libdnf-0.35.2-1.fc30.x86_64 $ where the asterisk '*' marks the updated dnf .rpms mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1663619#c12 . (Note: dnf-plugins-extras could not be found in updates-testing.) FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, dnf-plugins-extras-4.0.5-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report. |