Bug 855119

Summary: Corrupted config file / kickstart script data on postgresql
Product: [Community] Spacewalk Reporter: Stephen Herr <sherr>
Component: WebUIAssignee: Jan Pazdziora <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.8CC: jpazdziora
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: 2012-11-01 16:17:14 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: 871344    

Description Stephen Herr 2012-09-06 18:14:06 UTC
Description of problem:
If you are using the PostgreSQL database and a certain number of unknown other conditions are met, then config file and kickstart script contents appears corrupted in the webui. Unfortunately it is impossible to reproduce on some (most?) systems, due to some unknown variables. 

How reproducible:
On some systems, always, on other systems, never.

Steps to Reproduce:
1. View the contents of any config file or kickstart script in the webui
  
Actual results:
Contents are corrupted / are hex numbers instead of characters

Expected results:
File contents are displayed

Additional info:
This is due to the addition of a new and different default output style for bytea type fields in Postgres 9.0. In 9.0 the default output type is hex digits, whereas before then the only and default output type for bytea fields was the "escape" output type. All code in Spacewalk assumes it is receiving the "escape" type response from the bytea field, so if the database returns hex instead it doesn't know how to parse it and displays improperly.

The fix for this is really simple. We just need to set the tell the database to always use the escape output type for bytea fields:

ALTER DATABASE database SET bytea_output = 'escape';

Comment 1 Stephen Herr 2012-09-06 18:15:29 UTC
And not, in case it is not clear, the above fix should be safe on every system, regardless of if it is currently manifesting the problem or not.

Comment 2 Jan Pazdziora 2012-10-31 10:54:14 UTC
I believe this has been addressed in Spacewalk nightly / 1.8. The bytea_output is not needed (and could actually be harmful).

Comment 3 Jan Pazdziora 2012-11-01 16:17:14 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18