From b094f77592c59f9add05018e4e64e34f01528636 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Fri, 5 Dec 2008 09:08:13 +0000 Subject: [PATCH] make_image: ensure correct quoting of variables when calling genisoimage By first assembling the command in a variable and then using eval to execute it we avoid both duplication and errors passing quoted options in $MKISOFS_OPTS. --- debian/changelog | 6 +++++- tools/make_image | 54 ++++++++++++++---------------------------------- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/debian/changelog b/debian/changelog index ac253619..b9ec5770 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,7 +58,11 @@ debian-cd (3.1.0) UNRELEASED; urgency=low now just lists the files *within* the mirror; it's up to callers to prepend ${MIRROR} as needed. - -- Frans Pop Thu, 13 Nov 2008 22:17:21 +0100 + [ Frans Pop ] + * make_image: ensure correct quoting of variables when calling genisoimage. + Closes: #507300. + + -- Frans Pop Fri, 05 Dec 2008 10:04:03 +0100 debian-cd (3.0.5) unstable; urgency=low diff --git a/tools/make_image b/tools/make_image index 85732c72..19decce3 100755 --- a/tools/make_image +++ b/tools/make_image @@ -85,63 +85,39 @@ do # here... :-( if [ $JIGDO_WANTED = 0 ] && [ $ISO_WANTED = 1 ] ; then - echo $MKISOFS $MKISOFS_OPTS -V "$volid" -o $OUT/$OUTFILE.iso $opts $dirs CD$n - echo $MKISOFS $MKISOFS_OPTS -V "$volid" -o $OUT/$OUTFILE.iso $opts $dirs CD$n > CD$n/.disk/mkisofs - $MKISOFS $MKISOFS_OPTS -V "$volid" -o $OUT/$OUTFILE.iso $opts $dirs CD$n + CMD="$MKISOFS $MKISOFS_OPTS -V '$volid' \ + -o $OUT/$OUTFILE.iso $opts $dirs CD$n" + echo $CMD + echo $CMD > CD$n/.disk/mkisofs + eval "$CMD" elif [ $JIGDO_WANTED = 1 ] && [ $ISO_WANTED = 1 ] ; then - echo $MKISOFS $MKISOFS_OPTS -V "$volid" \ + CMD="$MKISOFS $MKISOFS_OPTS -V '$volid' \ -o $OUT/$OUTFILE.iso \ -jigdo-jigdo $OUT/$OUTFILE.jigdo \ -jigdo-template $OUT/$OUTFILE.template \ -jigdo-map Debian=$MIRROR/ \ -jigdo-exclude boot$n \ -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n - echo $MKISOFS $MKISOFS_OPTS -V "$volid" \ - -o $OUT/$OUTFILE.iso \ - -jigdo-jigdo $OUT/$OUTFILE.jigdo \ - -jigdo-template $OUT/$OUTFILE.template \ - -jigdo-map Debian=$MIRROR/ \ - -jigdo-exclude boot$n \ - -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n > CD$n/.disk/mkisofs - $MKISOFS $MKISOFS_OPTS -V "$volid" \ - -o $OUT/$OUTFILE.iso \ - -jigdo-jigdo $OUT/$OUTFILE.jigdo \ - -jigdo-template $OUT/$OUTFILE.template \ - -jigdo-map Debian=$MIRROR/ \ - -jigdo-exclude boot$n \ - -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n + $JIGDO_OPTS $opts $dirs CD$n" + echo $CMD + echo $CMD > CD$n/.disk/mkisofs + eval "$CMD" elif [ $JIGDO_WANTED = 1 ] && [ $ISO_WANTED = 0 ] ; then - echo $MKISOFS $MKISOFS_OPTS -V "$volid" \ + CMD="$MKISOFS $MKISOFS_OPTS -V '$volid' \ -o /dev/null \ -jigdo-jigdo $OUT/$OUTFILE.jigdo \ -jigdo-template $OUT/$OUTFILE.template \ -jigdo-map Debian=$MIRROR/ \ -jigdo-exclude boot$n \ -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n - echo $MKISOFS $MKISOFS_OPTS -V "$volid" \ - -o /dev/null \ - -jigdo-jigdo $OUT/$OUTFILE.jigdo \ - -jigdo-template $OUT/$OUTFILE.template \ - -jigdo-map Debian=$MIRROR/ \ - -jigdo-exclude boot$n \ - -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n > CD$n/.disk/mkisofs - $MKISOFS $MKISOFS_OPTS -V "$volid" \ - -o /dev/null \ - -jigdo-jigdo $OUT/$OUTFILE.jigdo \ - -jigdo-template $OUT/$OUTFILE.template \ - -jigdo-map Debian=$MIRROR/ \ - -jigdo-exclude boot$n \ - -md5-list $DIR/md5-check \ - $JIGDO_OPTS $opts $dirs CD$n + $JIGDO_OPTS $opts $dirs CD$n" + echo $CMD + echo $CMD > CD$n/.disk/mkisofs + eval "$CMD" else echo "Neither jigdo nor iso wanted for CD$n"