Description of problem: The /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh upgrade script, used to upgrade snippets created in Satellite 5.3 to the necessary format for Satellite 5.4, cannot handle snippets with unusual filenames (containing spaces or other such characters). Version-Release number of selected component (if applicable): rhn-upgrade-5.4.0.21-1.el5sat How reproducible: 100% Steps to Reproduce: 1. Create kickstart snippet with a space in the name, e.g., "funky snippet 1" on Satellite 5.3 or 5.4. 2. Run the upgrade script: /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh 3. See error: /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh: line 28: $f: ambiguous redirect Actual results: /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh: line 28: $f: ambiguous redirect Expected results: No error. Additional info: The following line in the upgrade-cobbler.sh script uses the 'find' command without any options for handling unusual filenames: find */* -type f 2>/dev/null | while read f; do Running this command manually on the directory /var/lib/cobbler/backup/snippets_spacewalk/ yields: # find /var/lib/cobbler/backup/snippets_spacewalk/*/* /var/lib/cobbler/backup/snippets_spacewalk/1/funky snippet 1 The variable f therefore acquires the value: /var/lib/cobbler/backup/snippets_spacewalk/1/funky snippet 1 When $f is redirected to sed: newf=$SNIPPET_DIR/$f # put #raw at the begining unless it's already there sed -e '1 {/^#raw$/b}' -e '1 {s/^/#raw\n/}' <$f >$newf bash tries to redirect "funky snippet 1", which appears to be three separate filenames, when it should be redirecting "funky\ snippet\ 1". Using the -print0 option for 'find' seems to fix the issue: # diff -pruN ./upgrade-cobbler-orig.sh ./upgrade-cobbler.sh --- ./upgrade-cobbler-orig.sh 2011-02-14 09:47:30.000000000 -0500 +++ ./upgrade-cobbler.sh 2011-02-14 09:47:43.000000000 -0500 @@ -22,7 +22,7 @@ SNIPPET_DIR=/var/lib/rhn/kickstarts/snip SNIPPET_BACKUP_DIR=/var/lib/cobbler/backup/snippets_spacewalk cp -aT $SNIPPET_DIR/ $SNIPPET_BACKUP_DIR/ 2>/dev/null pushd $SNIPPET_BACKUP_DIR >/dev/null -find */* -type f 2>/dev/null | while read f; do +find */* -type f -print0 2>/dev/null | while read f; do newf=$SNIPPET_DIR/$f # put #raw at the begining unless it's already there sed -e '1 {/^#raw$/b}' -e '1 {s/^/#raw\n/}' <$f >$newf
satellite.git SATELLITE-5.4: c41eea3ab30dd40e130d73264fc5342172a26824
I created 'custom snippet', appropriate snippet file path is: /var/lib/cobbler/snippets/spacewalk/1/custom snippet Running: # /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh # echo $? 0 # rpm -qf /etc/sysconfig/rhn/satellite-upgrade/upgrade-cobbler.sh rhn-upgrade-5.4.0.25-1.el6sat.noarch # Stage validated on Satellite-5.4.1-RHEL6-re20110530.0
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2011-0876.html