Bug 2325962

Summary: dnf5 can't download packages with a space in the URL
Product: [Fedora] Fedora Reporter: fedora.dm0
Component: dnf5Assignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 41CC: adam.martin223, chad.schroeder, gunaseelann, jkolarik, jrohel, kabhijeet, mblaha, nsella, pkratoch, ppisar, rpm-software-management
Target Milestone: ---Keywords: Regression, Reopened, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dnf5-5.2.17.0-1.fc43 dnf5-5.2.17.0-1.fc42 dnf5-5.2.17.0-1.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-11-04 04:55:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description fedora.dm0 2024-11-13 17:24:45 UTC
Since switching to dnf5 (and as of fully updated Fedora 41), package downloads fail if they have a space in the URL.  This was working with DNF 3 and 4.

Reproducible: Always

Steps to Reproduce:
> mkdir -p 'repo/test dir'
> dnf5 download --destdir='repo/test dir' filesystem
> createrepo_c repo
> dnf5 --disablerepo='*' --repofrompath=tmp,"file://$PWD/repo" --setopt=tmp.{gpgcheck,metadata_expire}=0 download filesystem
Actual Results:  
> Updating and loading repositories:
>  tmp
> Repositories loaded.
> Downloading Packages:
>  filesystem-0:3.18-23.fc41.x86_64
> >>> Curl error (3): URL using bad/illegal format or missing URL for file:///home/dm0/repo/test dir/filesystem-3.18-23.fc41.x86_64.rpm [URL rejected: Malformed input to a URL function] - file:///home/dm0/repo/test dir/filesystem-3.18-23.fc4
> >>> No more mirrors to try - All mirrors were already tried without successFailed to download packages
>  Librepo error: Cannot download test dir/filesystem-3.18-23.fc41.x86_64.rpm: All mirrors were tried

Expected Results:  
It should download the package from the local repo.

The download command will work with dnf-3 and dnf4 or if you remove the space with the following commands first.

> mv 'repo/test dir' repo/test-dir
> createrepo_c repo

The error happens with repositories on the web, I just used a local repo here for simplicity.  In particular, this is breaking a CI artifact host that puts packages in project-based subdirectories where project names can have spaces.

Comment 1 Jaroslav Rohel 2024-11-24 22:51:34 UTC
`createrepo_c` stores '<location href="test dir/filesystem-3.18-8.fc40.x86_64.rpm"/>' to the primary.xml file.
Special characters (and space) must be encoded in the URL. Usually the rule is applied to `href` as well.

And '<location href="test%20dir/filesystem-3.18-8.fc40.x86_64.rpm"/>' works with `dnf5` (`libdnf5`).
Is there a bug in `createrepo_c`? Is unencoded space in `href` correct?

However, the old dnf4 assumes an unencoded path in the `href`. So for compatibility we probably need to change `libdnf5` to behave like `dnf4` and assume an unencoded path in `href`.

Comment 2 Petr Pisar 2025-01-16 12:48:47 UTC
No, we need to fix createrepo_c to follow URI syntax as prescribed by XML. There is also a bug in DNF5 <https://github.com/rpm-software-management/dnf5/issues/1321>.

Comment 3 kabhij33t 2025-01-30 14:52:04 UTC
Hi RedHat Team,

Any update on this bug ? Can you share an ETA for the fix ?

Thanks
Abhijeet

Comment 4 Chad 2025-05-07 12:19:06 UTC
I have found a similar issue with dnf5 and packages with a carat character `^` in Fedora Linux 42 with dnf5-5.2.13.1

https://github.com/rpm-software-management/dnf5/issues/1321#issuecomment-2858261121

Comment 5 Petr Pisar 2025-05-07 13:00:00 UTC
No ETA. RedHat teams works on RHEL and RHEL does not use DNF5 now.

Comment 6 Petr Pisar 2025-07-21 10:15:01 UTC
*** Bug 2382271 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2025-09-02 11:55:18 UTC
FEDORA-2025-763e312d6a (dnf5-5.2.17.0-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-763e312d6a

Comment 8 Fedora Update System 2025-09-03 01:13:51 UTC
FEDORA-2025-763e312d6a has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-763e312d6a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-763e312d6a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2025-09-07 12:29:11 UTC
FEDORA-2025-763e312d6a (dnf5-5.2.17.0-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Petr Pisar 2025-10-30 16:32:25 UTC
*** Bug 2407379 has been marked as a duplicate of this bug. ***

Comment 11 Petr Pisar 2025-10-30 16:33:07 UTC
Reopening for fixing this in Fedora 42 and 41.

Comment 12 Fedora Update System 2025-10-31 09:21:49 UTC
FEDORA-2025-3ffc7cce52 (dnf5-5.2.17.0-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3ffc7cce52

Comment 13 Fedora Update System 2025-10-31 09:21:56 UTC
FEDORA-2025-d46e5baaa0 (dnf5-5.2.17.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-d46e5baaa0

Comment 14 Fedora Update System 2025-11-01 03:24:55 UTC
FEDORA-2025-3ffc7cce52 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-3ffc7cce52`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-3ffc7cce52

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2025-11-01 03:41:30 UTC
FEDORA-2025-d46e5baaa0 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-d46e5baaa0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-d46e5baaa0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2025-11-04 04:55:28 UTC
FEDORA-2025-3ffc7cce52 (dnf5-5.2.17.0-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2025-11-04 05:13:36 UTC
FEDORA-2025-d46e5baaa0 (dnf5-5.2.17.0-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.