]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[set-default-theme] Properly quote arguments to basename
authorBruce Jerrick <bmj001@gmail.com>
Tue, 6 Jul 2010 15:13:38 +0000 (11:13 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 6 Jul 2010 15:16:43 +0000 (11:16 -0400)
It's important to make sure the theme name is properly
quoted when passed to the basename command.  This
is because, if the theme name is empty we want the empty
string returned, not the suffix that would otherwise be
stripped off.

Some discussion here:
https://bugzilla.redhat.com/show_bug.cgi?id=606634

scripts/plymouth-set-default-theme.in

index 105cdd803fb84f9370e4d272f18640c6960ddb3a..d9b0f016c6207ecf52661b2b29964b3b4eec375f 100755 (executable)
@@ -38,7 +38,7 @@ function list_themes ()
 {
         for theme in ${PLYMOUTH_DATADIR}/plymouth/themes/*/*.plymouth; do
                 [ -f $theme ] || continue;
-                echo "$(basename $theme .plymouth)"
+                echo "$(basename "$theme" .plymouth)"
         done
 }
 
@@ -65,7 +65,7 @@ function get_default_theme ()
 
         if [ -z "$THEME_NAME" -o ! -r "${PLYMOUTH_DATADIR}/plymouth/themes/$THEME_NAME/$THEME_NAME.plymouth" \
              -a -L "${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth" ]; then
-                THEME_NAME=$(basename $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)
+                THEME_NAME=$(basename "$(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth)" .plymouth)
         fi
         if [ -z "$THEME_NAME" -o ! -r "${PLYMOUTH_DATADIR}/plymouth/themes/$THEME_NAME/$THEME_NAME.plymouth" ]; then
                 THEME_NAME="text"