Bug 1226329

Summary: Debian "Packages.gz" generation error. File not parseable with Debian 8
Product: [Community] Spacewalk Reporter: Robert Paschedag <robert.paschedag>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED EOL QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.2CC: cperry, goetz.dirk, hlawatschek, tony
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-21 12:11: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:
Attachments:
Description Flags
Error with original packages file for jessie main (binary-amd64) none

Description Robert Paschedag 2015-05-29 13:06:15 UTC
Created attachment 1032080 [details]
Error with original packages file for jessie main (binary-amd64)

Description of problem:

The "Packages.gz" file created by spacewalk is slightly wrong formated, so that a this file is not parseable by Debian systems.

Version-Release number of selected component (if applicable):

2.2 (also tested with 2.3)


How reproducible:

always


Steps to Reproduce:
1.

Sync all debian 8 packages of "main" (binary-amd64) into a spacewalk channel

2.

Install a debian 8 client and manually register it to spacewalk and add channel to client

3.

Run "apt-get update" (twice). Very first run after registration ok


Actual results:

see attachment apt-get_update_error_jessie.txt

Expected results:

No errors while parsing Packages.gz file

Additional info:

It turns out, that there is a space character missing within the parenthesis where the package version is listed.

Example:

Wrong "Depends" line of package "games-sport" (mentioned in attachment)

Depends: games-tasks (=1)

RIGHT "Depends" line (from original Debian Packages.gz)

Depends: games-tasks (= 1)  <== Space (" ") between operator and version string.

Temporary Workaround:

Modify the generated Packages file with

sed -e 's#(\([<>=]*\)\([^)]*\))#(\1 \2)#g' Packages | gzip -c > Packages.gz


Solution:

Just add a space between the operator and the version.

I followed the source until this file (funktion addPackageDebData)

https://github.com/spacewalkproject/spacewalk/blob/20dea1b0c8ba20e8e1663cff0d92f9795b3d54cd/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java

Regards,
Robert

Comment 1 Tomas Lestach 2015-06-01 09:14:18 UTC
Note: it looks the package capabilities are parsed incorrectly.

I suppose, the operator should not be a part of the version entry:
# select * from rhnPackageCapability where version like '>%';
   id    |  name   | version |            created            |           modified            
---------+---------+---------+-------------------------------+-------------------------------
 5961575 | libc6_0 | >=2.7   | 2015-06-01 10:38:42.641241+02 | 2015-06-01 10:38:42.641241+02

Comment 2 Robert Paschedag 2015-06-01 12:21:09 UTC
Then there should either be another field within the DB to hold the operator or - meybe easier, the operator and version be separated with a " "

When I read the code right, then the "deb822.py" file in /usr/lib/python2.6/site-packages/debian writes the version string correct.

...

    def str(rels):
        """Format to string structured inter-package relationships

        Perform the inverse operation of parse_relations, returning a string
        suitable to be written in a package stanza.
        """
        def pp_arch(arch_spec):
            (excl, arch) = arch_spec
            if excl:
                return arch
            else:
                return '!' + arch

        def pp_atomic_dep(dep):
            s = dep['name']
            if dep.get('version') is not None:
                s += ' (%s %s)' % dep['version']
            if dep.get('arch') is not None:
                s += ' [%s]' % ' '.join(map(pp_arch, dep['arch']))
            return s

        pp_or_dep = lambda deps: ' | '.join(map(pp_atomic_dep, deps))
        return ', '.join(map(pp_or_dep, rels))

So the "space" character seems to be stripped away somewhere else.

Regards,
Robert

Comment 3 Tomas Lestach 2015-06-01 13:17:39 UTC
(In reply to Robert Paschedag from comment #2)
> Then there should either be another field within the DB to hold the operator

There is.
See:
schema/spacewalk/common/tables/rhnPackageBreaks.sql
schema/spacewalk/common/tables/rhnPackageConflicts.sql
schema/spacewalk/common/tables/rhnPackageEnhances.sql
schema/spacewalk/common/tables/rhnPackageObsoletes.sql
schema/spacewalk/common/tables/rhnPackagePredepends.sql
schema/spacewalk/common/tables/rhnPackageProvides.sql
schema/spacewalk/common/tables/rhnPackageRecommends.sql
schema/spacewalk/common/tables/rhnPackageRequires.sql
schema/spacewalk/common/tables/rhnPackageSuggests.sql
schema/spacewalk/common/tables/rhnPackageSupplements.sql

it's the 'sense' column.
That's why I suppose, the debian package capabilities get incorrectly parsed.
(It's possible, they're written incorrectly as well, but the primary issue I see here is the parsing.)

Comment 4 Robert Paschedag 2015-06-09 11:45:25 UTC
Made a pull request to introduce a workaround (not a real fix) that just puts a space character between the operator and the version number if an operator is found within a "version" string. Only when generating the Packages.gz file.

https://github.com/spacewalkproject/spacewalk/pull/266

Regards,
Robert

Comment 5 Dirk Götz 2016-03-18 11:05:11 UTC
I can confirm this workaround works and would like to see this merged until a proper fix is found.

Regards,
 Dirk

Comment 6 Tomas Lestach 2016-05-10 17:42:50 UTC
Another attempt to fix this bug: https://github.com/spacewalkproject/spacewalk/pull/399

Comment 7 Michael Mráka 2019-10-21 12:11:10 UTC
Spacewalk 2.8 (and older) has already reached it's End Of Life.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before end of life. If you would still like
to see this bug fixed and are able to reproduce it against current version
of Spacewalk 2.9, you are encouraged change the 'version' and re-open it.