Bug 1421115 - en-dash (–) in %post section of kickstart causes it to be truncated when proxied via cobbler URL
Summary: en-dash (–) in %post section of kickstart causes it to be truncated when prox...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite Proxy 5
Classification: Red Hat
Component: Server
Version: 570
Hardware: x86_64
OS: Linux
high
high
Target Milestone: ---
Assignee: Gennadii Altukhov
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On:
Blocks: sat580-low
TreeView+ depends on / blocked
 
Reported: 2017-02-10 11:54 UTC by Neal Kim
Modified: 2021-08-30 12:11 UTC (History)
5 users (show)

Fixed In Version: spacewalk-java-2.5.14-65-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-21 12:07:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2919221 0 None None None 2017-02-10 20:39:04 UTC

Description Neal Kim 2017-02-10 11:54:24 UTC
Description of problem:

The existence of an en-dash in the %post section of a kickstart causes it to be truncated when requested via proxy by cobbler URL.

# printf %d\\n \'–
8211

ASCII character 8211 (en dash)

Regardless of whether or not the line containing an en-dash is commented ("#") the kickstart still ends up being truncated.

Using the cobbler ISO as an example, the kickstart line ("ks=") is hard coded like so:

ks=http://<PROXY_FQDN>/cblr/svc/op/ks/profile/<COBBLER_PROFILE>

When the kickstart is retrieved through a RHN Proxy the file ends up being truncated at the end:

...
wget "http://<PROXY_FQDN>/cblr/svc/op/ks/profile/<COBBLER_PROFILE>" -O /root/cobbler.ks
wget "http://<PROXY_FQDN>/cblr/svc/op/trig/mode/post/profile/<COBBLER_PROFILE>" -O /dev/null
%en <--- truncated

This will break provisioning as you could imagine.

But when the kickstart is retrieved through Satellite the file is intact.

Incidentally, it seems the number of characters truncated is equal to the number of en-dash(es).


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

* Satellite v5.7
* RHN-Proxy v5.7


How reproducible:

Always.


Steps to Reproduce:

1. Install Satellite v5.7
2. Install RHN-Proxy v5.7
3. Register RHN-Proxy to Satellite
4. Create a new RHEL 6 kickstart (probably applies to any version but didn't test)
5. Add a new %post script (using "Shell" type) to the kickstart with an en-dash ("–")
6. Attempt to download the kickstart going through the proxy via wget/curl:

wget "http://<PROXY_FQDN>/cblr/svc/op/ks/profile/<COBBLER_PROFILE>"

7. Observe that the kickstart is truncated


Actual results:

Kickstart file is truncated.


Expected results:

Kickstart is not truncated.


Additional info:

Retrieving the kickstart from both the Satellite or Proxy via the "Bare Metal Kickstart" URL works just fine:

http://<FQDN>/ks/cfg/org/1/label/<KICKSTART_PROFILE>

Comment 2 Gennadii Altukhov 2017-03-13 09:47:44 UTC
Hello Neal,
I've tried to reproduce this bug both on Satellite 5.7 and upstream and, actually, cannot do this.

My steps:

1) Create a new KS profile for RHEL 6.
2) Add post script which contains en-dash(–) to kickstart file in my profile.
3) Register proxy (RHEL6) to Satellite server.
4) Register client via proxy.
5) Try to download kickstart file from client via proxy using wget:
wget http://elisha.brq.redhat.com/cblr/svc/op/ks/profile/galtkickstart:1:RedHatSatTeamQA -O /root/kickstart.ks


Result:
I cannot download kickstart file  w/o truncations.

Packages on my proxy:
spacewalk-proxy-broker-2.3.0-6.el6sat.noarch
spacewalk-proxy-management-2.3.0-6.el6sat.noarch
spacewalk-proxy-common-2.3.0-6.el6sat.noarch
spacewalk-proxy-installer-2.3.0-7.el6sat.noarch

Post script:
#test en-dash –
echo –
echo "should be truncated start from here"
printf %d\\n \'–

echo "^^^ code of en-dash"

#comment


Can you, please, review my steps, what I'm doing wrong?

Comment 3 Neal Kim 2017-03-13 12:10:06 UTC
Hello Gennadi,

I confirm the same packages are installed on my test setup:

spacewalk-proxy-broker-2.3.0-6.el6sat.noarch
spacewalk-proxy-management-2.3.0-6.el6sat.noarch
spacewalk-proxy-common-2.3.0-6.el6sat.noarch
spacewalk-proxy-installer-2.3.0-7.el6sat.noarch

Your steps look fine, although I registered the proxy before creating the kickstart. Not sure if that would make much of a difference though.

I just tried the test again with your %post script and it is truncated for me.

At the end of the kickstart you downloaded does it look like this?

"""
# Start koan environment setup
echo "export COBBLER_SERVER=192.168.122.117" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER 192.168.122.117" > /etc/profile.d/cobbler.csh
# End koan environment setup



wget "http://192.168.122.117/cblr/svc/op/ks/profile/nkimtest:1:RedHat" -O /root/cobbler.ks
wget "http://192.168.122.117/cblr/svc/op/trig/mode/post/profile/nkimtest:1:RedHat" -O /dev/null
"""

Notice there is no %end at the very end of the file.

Comment 6 Gennadii Altukhov 2017-03-14 09:25:43 UTC
Hello Neal,

Thank you, now I see the problem, continue the investigation.

Comment 7 Gennadii Altukhov 2017-03-27 10:02:41 UTC
bug is fixed in upstream. spacewalk.git:
c15e6e28a2655fcd74fefed853f3f8ce707ed390

Comment 10 Pavel Studeník 2017-05-22 15:13:41 UTC
Reproducer:

1) Create kickstart with following post scripts :

#test en-dash – – – – – – – – – – – – – – –
printf %d\\n \'– 
#test en-dash – – – – – – – – – – – – – – –


2) got link http://<proxy>/cblr/svc/op/ks/profile/<profile> and download or look at them:

# Start koan environment setup
echo "export COBBLER_SERVER=host-172-16-20-190.openstacklocal" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER host-172-16-20-190.openstacklocal" > /etc/profile.d/cobbler.csh
# End koan environment setup



wget "http://host-172-16-20-190.openstacklocal/cblr/svc/op/ks/profile/rhel-server-6:1:RedHatSatTeamQA" -O /root/cobbler.ks
wget "http://host-172-16-20-190.openstacklocal/cblr/svc/op/trig/mode/po 


original (file ends correct with "%end") :

....
wget "http://host-172-16-20-190.openstacklocal/cblr/svc/op/trig/mode/post/profile/rhel-server-6:1:RedHatSatTeamQA" -O /dev/null
%end


Verified with spacewalk-java-2.5.14-84.el6sat.noarch


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