Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1878924
Summary: | mock fails in _copy_config with FileNotFoundError for /etc/resolv.conf in some circumstances | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Adam Williamson <awilliam> |
Component: | mock | Assignee: | Pavel Raiskup <praiskup> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 33 | CC: | copr-team, jkeating, kevin, mcatanza, mebrown, msuchy, philip.wyett, praiskup, robatino, williams, zbyszek |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | openqa | ||
Fixed In Version: | mock-2.6-1.fc32 mock-2.6-1.el7 mock-2.6-1.el8 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-09-19 22:39:10 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: | |||
Bug Depends On: | |||
Bug Blocks: | 1829022, 1834846 |
Description
Adam Williamson
2020-09-14 22:41:30 UTC
This also appears to have broken today's Rawhide compose: https://pagure.io/releng/failed-composes/issue/1761 Thank you for the report, Adam.
What SUT stands for?
> https://src.fedoraproject.org/rpms/systemd/c/b98737cec484f1c8dcb839e97192809b99f77c89?branch=f33
Great analysis, that indeed triggered the problems. This all is caused by (to me) unexpected
shutil.copy*() behavior:
$ mkdir /tmp/a
$ ln -s non-existing-file /tmp/a/resolv.conf
$ mkdir /tmp/b
$ echo content > /tmp/b/resolv.conf
$ ipyton3
In [1]: import shutil
In [2]: shutil.copy2("/tmp/b/resolv.conf", "/tmp/a")
Out[2]: '/tmp/a/resolv.conf'
In [3]:
Do you really want to exit ([y]/n)? y
$ cat /tmp/a/non-existing-file
content
IOW, shutil.copy() follows symlinks in dst=, and creates the non-existing file. Seems
like we have to unlink the destination file first.
Heh, shutil.copy2() even has a follow_symlinks= argument, but it doesn't work! With follow_symlinks=False, the symlink in /tmp/a is still followed. _copy_config() already removes the destination path, but it uses os.path.exists() which returns false for broken symlinks. Maybe use os.access() instead? There's e.g. https://bugs.python.org/issue34374 - and per the report, /bin/cp indeed behaves the same, except for the "dangling" symlink situation: $ cp b/resolv.conf a/resolv.conf cp: not writing through dangling symlink 'a/resolv.conf' I reported that. > _copy_config() already removes the destination path, but it uses os.path.exists()
> which returns false for broken symlinks. Maybe use os.access() instead?
That sounds racy (as well as the current behavior). Is it any better to just
try to remove the destination file, and ignore FileNotFoundError?
So, I guess we need a new mock build for Rawhide at least. If we are still planning to have the change in F33, we need a new mock build for F33 as well and it should be added to the systemd update, I think. FEDORA-2020-f7ce2b3a71 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-f7ce2b3a71 FEDORA-2020-8b8b3ade7b has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-8b8b3ade7b FEDORA-EPEL-2020-07a27d3e56 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-07a27d3e56 FEDORA-EPEL-2020-07a27d3e56 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-07a27d3e56 FEDORA-EPEL-2020-0996fb7a3c has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-0996fb7a3c FEDORA-2020-f7ce2b3a71 has been pushed to the Fedora 32 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-f7ce2b3a71` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f7ce2b3a71 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2020-0996fb7a3c has been pushed to the Fedora EPEL 7 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-0996fb7a3c See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2020-07a27d3e56 has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-07a27d3e56 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2020-ef6074cb37 has been pushed to the Fedora 31 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-ef6074cb37` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-ef6074cb37 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2020-8b8b3ade7b has been pushed to the Fedora 33 testing repository. In short time you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-8b8b3ade7b` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-8b8b3ade7b See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2020-f7ce2b3a71 has been pushed to the Fedora 32 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2020-ef6074cb37 has been pushed to the Fedora 31 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2020-8b8b3ade7b has been pushed to the Fedora 33 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-EPEL-2020-0996fb7a3c has been pushed to the Fedora EPEL 7 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-EPEL-2020-07a27d3e56 has been pushed to the Fedora EPEL 8 stable repository. If problem still persists, please make note of it in this bug report. |