Red Hat Bugzilla – Bug 1186948
[download] data loss: dnf download should not delete files from local repositories
Last modified: 2015-05-21 09:02:40 EDT
I have repository on my local filesystem and `dnf download` crashing with OSError because it's not downloading pkg and trying to move pkg.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1059, in run
File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 94, in run
File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 196, in _move_package
OSError: [Errno 13] Permission denied: '/var/lib/dnf/plugins/local/bc-1.06.95-13.fc22.x86_64.rpm'
Hi Igor, what was your $PWD? Does it work with root access?
(In reply to Jan Silhan from comment #1)
> Hi Igor, what was your $PWD? Does it work with root access?
$PWD = ~/
yes, it works with root access, because it's copying rpm file from local repo (only-root-rw) and removing rpm from local repo.
it's need to be fixed in code while we checking from what repo we are downloading package and repo url =~ file://.* - don't do os.unlink()
Igor, if you already know how to fix this, make a PR, please. Otherwise I am giving it a low prio.
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.
More information and reason for this action is here:
I was just filing a bug about this, but discovered this one.
*NB* all the following commands are executed as non-root.
Create a local repository:
dnf download bash
Observe that the local repo contains a bash-*.rpm file and the
Create a yum.conf pointing to the local repository:
cat > yum.conf <<'EOF'
Now download files using the local repository:
dnf download -v -c yum.conf bash
The 'dnf download' command works -- that is not the issue. However
go and look back in the /tmp/repo directory. The dnf command has
deleted the original RPM in the local repository!
Version-Release number of selected component (if applicable):
(In reply to Jan Silhan from comment #3)
> Igor, if you already know how to fix this, make a PR, please. Otherwise I am
> giving it a low prio.
What is a PR? IMO this is a very serious bug. dnf download
should not touch original repositories.
Moreover, I think that the plugin should not *move* the files, it should be enough to *copy* them since dnf.Base takes care of removing the packages downloaded using "download_packages" and it already tests whether they were really downloaded or whether they are available in a local repository.
I applied your test patch to dnf-plugins-core, and I can confirm that
it fixes the case outlined in comment 5.
dnf-plugins-core-0.1.7-1.fc22,hawkey-0.5.5-1.fc22,dnf-1.0.0-1.fc22 has been submitted as an update for Fedora 22.
Package dnf-plugins-core-0.1.7-1.fc22, hawkey-0.5.5-1.fc22, dnf-1.0.0-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.1.7-1.fc22 hawkey-0.5.5-1.fc22 dnf-1.0.0-1.fc22'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
dnf-plugins-core-0.1.7-1.fc22, hawkey-0.5.5-1.fc22, dnf-1.0.0-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Can confirm this is fixed in