Bug 1722493

Summary: gpgcheck=0 in a /etc/yum.repos.d/ .repo file is ignored
Product: Red Hat Enterprise Linux 8 Reporter: Jiri Danek <jdanek>
Component: dnfAssignee: Jaroslav Rohel <jrohel>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: medium Docs Contact:
Priority: high    
Version: 8.1CC: dmach, james.antill, jwboyer, mblaha, mdomonko, rkubis
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libdnf-0.35.1-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:22: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: 1722637    

Comment 5 Jiri Danek 2019-06-21 07:50:13 UTC
You are correct, the machine had, when I kicked it up, the following config, and it was overriding what was in /etc/yum.repos.d/pulp.repo

# cat /etc/yum.conf 
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True

As far as I remember, I never had to touch /etc/yum.conf to permit installing unsigned packages from repos. Is this some new intentional feature in RHEL 8.1?

Comment 6 Radim Kubis 2019-06-21 08:51:32 UTC
I can confirm that I did not need to touch /etc/yum.conf on RHEL6, RHEL7 and RHEL8 before, when my repofiles in /etc/yum.repos.d had gpgcheck=0 although gpgcheck was set to 1 in /etc/yum.conf

Comment 8 Jaroslav Mracek 2019-06-21 11:56:29 UTC
I am investigating the issue, but so far I am unable to reproduce it. Please could you provide additional information:
Output as an attachment from: "yum repolist --all -v"
                              "rpm -q dnf libdnf"

Also a content from all .repo file from `/etc/yum.repos.d` is needed.

Please could you also provide an information about subscription on the system? Important is also to know whatever the issue is reproducible without the subscription plugin ("--disableplugin=*").

PS: The reproducer in Comment 1 cannot be accessed.
PPS: The presented behavior in the bug is not intended, but cannot say where is the problem due to impossibility to reproduce it.

Comment 9 Jaroslav Mracek 2019-06-21 13:40:11 UTC
The problem cannot be reproduce with dnf-4.0.9, but can be reproduced with dnf-4.2.6.

Comment 10 Jaroslav Mracek 2019-06-21 14:32:38 UTC
It looks like that the last entry in repo file is ignored. But the situation will be more difficult because rhel-8-Server-AppStream doesn't work, but rhel-8-Server-AppStream1 and rhel-8-Server-AppStream2 like expected.

[rhel-8-Server-AppStream]
name=rhel-8-server-AppStream/8Server/x86_64
baseurl=http://download.devel.redhat.com/rel-eng/rhel-8/RHEL-8/RHEL-8.1.0-20190619.2/compose/AppStream/x86_64/os/
enabled=1
gpgcheck=0


[rhel-8-Server-AppStream1]
name=rhel-8-server-AppStream/8Server/x86_64
baseurl=http://download.devel.redhat.com/rel-eng/rhel-8/RHEL-8/RHEL-8.1.0-20190619.2/compose/AppStream/x86_64/os/
enabled=1
gpgcheck=0
# hi

[rhel-8-Server-AppStream2]
name=rhel-8-server-AppStream/8Server/x86_64
baseurl=http://download.devel.redhat.com/rel-eng/rhel-8/RHEL-8/RHEL-8.1.0-20190619.2/compose/AppStream/x86_64/os/
gpgcheck=0
enabled=1

Comment 12 Jaroslav Rohel 2019-06-24 16:06:43 UTC
Config parser supports multiline values. Example:
key = value first line
  value second line
If a line starts with whitespace characters and it is not a section name, it is treated as continuation of previous key=value line.

In this case a line with white spaces is after "gpgcheck=0". The value was parsed as "0\n" (zero with empty line -> not later convertible to boolean) instead of "0".
I made a fix that ignores trailing blank lines. So, newline characters are trimmed out from the end of line.

PR: https://github.com/rpm-software-management/libdnf/pull/754

Note:
Support for multiline values are for yum compatibility. But I hope that nobody is using this feature. It is not supported in old libdnf "context" part. -> It is not working with microdnf, PackageKit, ...

Comment 13 Marek Blaha 2019-06-25 05:57:57 UTC
So the workaround until the patch from comment12 gets released is to remove spaces from all "empty" lines in config file.

Added test in PR https://github.com/rpm-software-management/ci-dnf-stack/pull/567

Comment 19 errata-xmlrpc 2019-11-05 22:22:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3583