Bug 1385726 - Package description encoding issue
Summary: Package description encoding issue
Keywords:
Status: CLOSED EOL
Alias: None
Product: Red Hat Network
Classification: Retired
Component: RHN/Backend
Version: _unset
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard Bernleithner
QA Contact:
URL:
Whiteboard:
: 1437011 (view as bug list)
Depends On:
Blocks: 1305744 sat5-rhn
TreeView+ depends on / blocked
 
Reported: 2016-10-17 15:15 UTC by Ondrej Gajdusek
Modified: 2021-09-09 11:58 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Ondrej Gajdusek 2016-10-17 15:15:24 UTC
Description of problem:
Package decription in some packages is corrupted when the package is downloaded via satellite-sync from RHN. Otherwise when the package is downloaded from RHN using WEB-UI and then imported to Satellite via rhnpush, there is no problem with package description encoding. 
I tried download and import the package as I described and then created new channel for testing purposes in Satellite, I imported the recently imported package into the channel and created channel dump via satellite-exporter. After that I imported this dump to Satellite via satellite-sync and the result was okay. This problem occurs only when the package is downloaded from RHN via satellite-sync.
In next step I deleted the package with corrupted desctiption from Satellite database and '/var/satellite/redhat/NULL/*/checkpolicy/' and I also deleted '/var/cache/rhn/satsync/packages/'. Then I started satellite-sync and it downloaded the missing package from RHN. The '/var/cache/rhn/satsync/packages/' contained only one directory and one cache file in it.
So I looked into the code to the part where the data are unpacked. Specifically in rhnCache.py.  
I made patch for rhnCache.py and now you can see the data we are recieving from RHN.

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

How reproducible:
Every time

Steps to Reproduce:
1. Apply the patch for rhnCache.py
2. Sync channel which contains package 'checkpolicy' via satellite-sync. In my case 'rhel-i386-server-5.0.z'.
3. Take a look into '/var/log/rhn/rhn_server_satellite.log' and search for 'checkpolicy description'.
4. This output shows the package description entry from the variable which contains the decompressed cachefile.

Actual results:
Package description encoding is corrupted near registered trademark symbol. 

Expected results:
Satellite-sync should get the "cachefile" with non-corrupted encoding. 

Additional info:
If you want to resync channel to see the output for the specific package, you can use commands listed below to delete the package from database. Also do not forget to delete the package from the '/var/satellite/redhat/NULL/*/checkpolicy'.

echo "delete from rhnchannelpackage where package_id=(select id from rhnpackage where name_id=(select id from rhnpackagename where name like '%checkpolicy%'));" | spacewalk-sql -i
echo "delete from rhnpackage where id=(select id from rhnpackage where name_id=(select id from rhnpackagename where name like '%checkpolicy%'));" | spacewalk-sql -i

Package description itself is unharmed. You can check it there: 'rpm -qip /var/satellite/redhat/NULL/cf2/checkpolicy/*/*/*/*.rpm'

Does not matter for which architecture the package is designed. Description of the package is the same for all architectures.

This problem does not affect only the package "checkpolicy"!

Patch:

30a31,36
> from spacewalk.common.rhnLog import initLOG
> from spacewalk.common.rhnConfig import CFG, initCFG, PRODUCT_NAME
> initCFG('server.satellite')
> initLOG(CFG.LOG_FILE, CFG.DEBUG)
> from spacewalk.satellite_tools.syncLib import log, log2, log2disk, log2stderr, log2email
> 
356c362,367
<             return cPickle.loads(pickled)
---
>             tempvar = cPickle.loads(pickled)
>             if tempvar.data.get('name')=='checkpolicy' and tempvar.data.get('description'):
>                 log(1, ("following data are from : %s") % name)
>                 log(1, ("checkpolicy description: %s") % tempvar.data.get('description'))
> 
>             return tempvar
405a417
>

Comment 1 Ondrej Gajdusek 2016-10-21 12:24:18 UTC
To be concrete, the patch I mentioned above is patch for the Satellite's "/usr/lib/python2.6/site-packages/spacewalk/common/rhnCache.py".

For a better understanding I will mention steps to reproduce more accurately.
1. Have Satellite installed on server
2. Apply the patch to rhnCache.py
3. run satellite-sync: "satellite-sync -c rhel-i386-server-5.0.z". It will take something about 6h.
4. After the process finished, take a look into "/var/log/rhn/rhn_server_satellite.log" and search for 'checkpolicy description'. This output shows the package description entry from the variable which contains the decompressed cachefile (in case of "checkpolicy" it is "rhn-package-387762").

To get the cache file located in /var/cache/rhn/satsync/packages/ Satellite uses RHN API call "packages" from "satellite_exporter/handlers/auth_dumper.py". I threw an eye on this file, but am not sure if this is the correct API call which Satellite uses. After the satellite-sync print "Downloading package metadata" to the log it calls StreamProducer on line 1106 in "/satellite_tools/satsync.py" which call function "getPackageXmlStream" in "/backend/satellite_tools/xmlWireSource.py" (with parameter packageIds="rhn-package-387762" - this is the concrete ID of "checkpolicy" package) and return value of this API call is then stored in variable "stream" in "satsync.py" at line 2014. In this case "stream" is, in essence, gzip file, which is subsequently stored in "/var/cache/rhn/satsync/packages/<last-two-digits-of-packageIds>/<packageIds>".
Please check the return value of "packages" API call, especially check if it is correctly encoded.

Comment 2 Ondrej Gajdusek 2016-10-21 13:56:09 UTC
When I look at the "checkpolicy" description at WebUI I see this:
http://file.brq.redhat.com/~ogajduse/BZ1385726/Selection_007.png

Expected result is:
http://file.brq.redhat.com/~ogajduse/BZ1385726/Selection_008.png

Comment 3 Tomas Lestach 2017-05-26 08:53:54 UTC
*** Bug 1437011 has been marked as a duplicate of this bug. ***

Comment 4 Thomas "Shea" DeAntonio 2017-07-05 15:09:17 UTC
As you may already be aware, Red Hat is transitioning from the Red Hat Network (RHN) hosted interface to the Red Hat Subscription Management (RHSM) interface in July 2017. Red Hat has invested in and seen success from RHN for many years, and used that experience to build more robust technologies like RHSM. 
 
If you have not yet migrated your RHN systems to RHSM or you are a Red Hat Satellite customer, please review the information from. https://access.redhat.com/products/red-hat-subscription-management#migration. 
 
Since we are shutting down RHN, no further actions will be taken with this bug or enhancement request.  You can find additional information at RHSM product page (https://access.redhat.com/products/red-hat-subscription-management).  If you have further questions, please contact support (https://access.redhat.com/products/red-hat-subscription-management#support).

Comment 5 Thomas "Shea" DeAntonio 2017-07-05 15:11:05 UTC
As you may already be aware, Red Hat is transitioning from the Red Hat Network (RHN) hosted interface to the Red Hat Subscription Management (RHSM) interface in July 2017. Red Hat has invested in and seen success from RHN for many years, and used that experience to build more robust technologies like RHSM. 
 
If you have not yet migrated your RHN systems to RHSM or you are a Red Hat Satellite customer, please review the information from. https://access.redhat.com/products/red-hat-subscription-management#migration. 
 
Since we are shutting down RHN, no further actions will be taken with this bug or enhancement request.  You can find additional information at RHSM product page (https://access.redhat.com/products/red-hat-subscription-management).  If you have further questions, please contact support (https://access.redhat.com/products/red-hat-subscription-management#support).


Note You need to log in before you can comment on or make changes to this bug.