Bug 2024430
Summary: | dnf system-upgrade with --downloaddir uses rm -rf and will destroy user data | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Linuxguy123 <linuxguy123> | ||||
Component: | dnf-plugins-extras | Assignee: | amatej | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | urgent | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 35 | CC: | amatej, daniel.mach, gordon.messmer, jkadlcik, jmracek, martin.bukatovic, mblaha, pkratoch, rpm-software-management, samuel-rhbugs, vmukhame | ||||
Target Milestone: | --- | Keywords: | Triaged | ||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | dnf-plugins-extras-4.0.16-1.fc37 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2022-03-14 13:09:41 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
Linuxguy123
2021-11-18 04:50:34 UTC
> dnf system-upgrade download --downloaddir=/home --releasever=35
Because dnf removes the downloaddir on completion, I'd like to suggest that it should check downloaddir before it begins and refuse to accept a directory that is not empty.
It does not remove the directory. Look at /var/lib/dnf/system-upgrade on a system that you've done an upgrade on. It removes *everything* within that directory, recursively, ie including sub directories. I shared this with the dnf developers on github. https://github.com/rpm-software-management/dnf-plugins-extras/issues/200 > It does not remove the directory. Look at /var/lib/dnf/system-upgrade on a system that you've done an upgrade on.
I don't think that's adequate as contrary evidence. The system-upgrade plugin code looks like it'll remove the cachedir and, if it was specified, the "destdir" (which is set by --downloaddir). As far as I can tell, /var/lib/dnf/system-upgrade is not either of those things when --downloaddir isn't specified.
As the code points out, dnf system-upgrade does a rm -rf on "fullpath". It appears that if --downloaddir isn't used, fullpath is /var/lib/dnf/system-upgrade. If you use --downloaddir, then it is whatever dir you give it. Yes it unfortunately cleans everything in the destdir (can be specified by --destdir or --downloaddir). I made a PR to fix this: https://github.com/rpm-software-management/dnf-plugins-extras/pull/201 and also tests for it: https://github.com/rpm-software-management/ci-dnf-stack/pull/1056 FEDORA-2022-e119fcc7d5 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-e119fcc7d5 FEDORA-2022-e119fcc7d5 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report. |