Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: variables in --setopt not parsed #1941

Open
madonuko opened this issue Dec 8, 2024 · 8 comments
Open

Regression: variables in --setopt not parsed #1941

madonuko opened this issue Dec 8, 2024 · 8 comments
Labels
Priority: LOW Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@madonuko
Copy link
Contributor

madonuko commented Dec 8, 2024

In dnf-3, $releasever and other variables passed into --setopt would be expanded.
This behaviour has been seen for older versions of dnf5 (e.g. 5.2.6.2) but not on latest versions (5.2.7.0)

dnf-3 behaviour

$ podman run -it fedora-minimal:41
bash-5.2# dnf in dnf-3 -y
…

bash-5.2# dnf-3 install --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release
Added terra repo from https://repos.fyralabs.com/terra$releasever
Fedora 41 - x86_64                               15 MB/s |  34 MB     00:02    
Fedora 41 openh264 (From Cisco) - x86_64        736  B/s | 1.4 kB     00:01    
Fedora 41 - x86_64 - Updates                    2.4 MB/s | 5.9 MB     00:02    
terra                                           175 kB/s | 688 kB     00:03    
Dependencies resolved.
================================================================================
 Package                 Architecture     Version         Repository       Size
================================================================================
Installing:
 terra-release           noarch           41-3            terra           7.3 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 7.3 k
Installed size: 672  
Is this ok [y/N]: y
Downloading Packages:
terra-release-0:41-3.noarch.rpm                 6.7 kB/s | 7.3 kB     00:01    
--------------------------------------------------------------------------------
Total                                           6.7 kB/s | 7.3 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : terra-release-41-3.noarch                              1/1 

Installed:
  terra-release-41-3.noarch                                                     

Complete!

dnf5 behaviour

Working

bash-5.2# dnf install -y --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release
Updating and loading repositories:
 Fedora 41 openh264 (From Cisco) - x86_ 100% |   2.1 KiB/s |   4.8 KiB |  00m02s
 Fedora 41 - x86_64                     100% |  18.7 MiB/s |  35.4 MiB |  00m02s
 Fedora 41 - x86_64 - Updates           100% |   2.6 MiB/s |   6.1 MiB |  00m02s
 terra                                  100% | 202.0 KiB/s | 716.7 KiB |  00m04s
Repositories loaded.
Package                  Arch    Version                  Repository        Size
Installing:
 terra-release           noarch  41-3                     terra        672.0   B

Transaction Summary:
 Installing:         1 package

Total size of inbound packages is 7 KiB. Need to download 7 KiB.
After this operation, 672 B extra will be used (install 672 B, remove 0 B).
[1/1] terra-release-0:41-3.noarch       100% |   8.8 KiB/s |   7.3 KiB |  00m01s
--------------------------------------------------------------------------------
[1/1] Total                             100% |   8.8 KiB/s |   7.3 KiB |  00m01s
Running transaction
[1/3] Verify package files              100% |   0.0   B/s |   1.0   B |  00m00s
[2/3] Prepare transaction               100% | 111.0   B/s |   1.0   B |  00m00s
[3/3] Installing terra-release-0:41-3.n 100% |   6.2 KiB/s | 936.0   B |  00m00s
Warning: skipped PGP checks for 1 package from repository: terra
Complete!
bash-5.2# dnf --version
dnf5 version 5.2.6.2
dnf5 plugin API version 2.0
libdnf5 version 5.2.6.2
libdnf5 plugin API version 2.0

Not working

Obtained latest dnf5 via dnf up in the container.

bash-5.2# dnf install --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release   
Updating and loading repositories:
 terra                                  100% | 185.6 KiB/s | 716.1 KiB |  00m04s
Repositories loaded.
Package                  Arch    Version                  Repository        Size
Installing:
 terra-release           noarch  41-3                     terra        672.0   B

Transaction Summary:
 Installing:         1 package

Total size of inbound packages is 7 KiB. Need to download 7 KiB.
After this operation, 672 B extra will be used (install 672 B, remove 0 B).
Is this ok [y/N]: y
[1/1] terra-release-0:41-3.noarch       100% |   6.9 KiB/s |   7.3 KiB |  00m01s
--------------------------------------------------------------------------------
[1/2] https://repos.fyralabs.com/terra$ ???% |  57.0   B/s | 106.0   B |  00m02s
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
--------------------------------------------------------------------------------
[2/2] Total                             100% |   6.9 KiB/s |   7.3 KiB |  00m01s
Failed to download files
 Librepo error: Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP: 46.4.197.184)
bash-5.2# dnf install --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release -y
Updating and loading repositories:
Repositories loaded.
Package                  Arch    Version                  Repository        Size
Installing:
 terra-release           noarch  41-3                     terra        672.0   B

Transaction Summary:
 Installing:         1 package

Total size of inbound packages is 7 KiB. Need to download 0 B.
After this operation, 672 B extra will be used (install 672 B, remove 0 B).
[1/1] terra-release-0:41-3.noarch       100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
--------------------------------------------------------------------------------
[1/2] https://repos.fyralabs.com/terra$ ???% |  60.0   B/s | 106.0   B |  00m02s
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
>>> Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP
--------------------------------------------------------------------------------
[2/2] Total                             100% |   0.0   B/s |   0.0   B |  00m00s
Failed to download files
 Librepo error: Status code: 404 for https://repos.fyralabs.com/terra$releasever/key.asc (IP: 46.4.197.184)
bash-5.2# dnf --version
dnf5 version 5.2.7.0
dnf5 plugin API version 2.0
libdnf5 version 5.2.7.0
libdnf5 plugin API version 2.0
@progressive-galib
Copy link

i am open to pick this issue up, but i gotta know where to look, little first guidance will help a lot

@madonuko
Copy link
Contributor Author

I just tried compiling dnf5 manually inside fedora-minimal:41 and fedora-minimal:40 on tag 5.2.7.0 and failed to repro:

FROM fedora-minimal:41

RUN dnf5 install -y 'dnf5-command(builddep)'
COPY dnf5 .
RUN dnf5 builddep -y dnf5.spec --setopt=install_weak_deps=False
RUN cmake . --install-prefix /usr/ && make -j20
RUN echo '' > doc/cmake_install.cmake
RUN make install -j20
RUN dnf5 install --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' --setopt='terra.gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc' terra-release -y

Maybe it is possible that this issue does not come from dnf5 itself…?

@madonuko
Copy link
Contributor Author

@pkratoch
Copy link
Contributor

pkratoch commented Jan 3, 2025

The variables are indeed substituted only in the repofrompath option, but not in the setopt option.

This is a difference from dnf-3, but it's the same across the dnf5 versions. The only reason why some dnf5 version passed is that the PGP checks were skipped, so the URL was not accessed and it did not fail on it. There is probably a different pkg_gpgcheck configuration.

@pkratoch pkratoch added Priority: LOW Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take labels Jan 3, 2025
@madonuko
Copy link
Contributor Author

madonuko commented Jan 3, 2025

Are there plans to make the variables in setopt substituted in dnf5?

@pkratoch
Copy link
Contributor

pkratoch commented Jan 3, 2025

Are there plans to make the variables in setopt substituted in dnf5?

I think it should be done, but it doesn't have a high priority right now.

@progressive-galib
Copy link

just tell where is the code i will do it myself.

@pkratoch
Copy link
Contributor

pkratoch commented Jan 7, 2025

just tell where is the code i will do it myself.

I would try to look into the aforementioned context, or main. The question also is if it's desired to replace variables in setopt in general, or only in repository setopts (there is a method Context::Impl::apply_repository_setopts that might be relevant). But I didn't look into it in depth. Mostly, finding where to make the fix and ensuring that it behaves correctly even in edge cases is what makes fixing any bug difficult, not just writing the one line that is needed at the end. But any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: LOW Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
None yet
Development

No branches or pull requests

3 participants