This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=8f14ffd71be934539e57e743aba533702ef59b53

commit 8f14ffd71be934539e57e743aba533702ef59b53
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Oct 9 23:53:14 2018 +0200

    shell: Quote variables
    
    Reported-by: Johannes Schauer <[email protected]>
    Warned-by: shellcheck
---
 debian/changelog                   | 1 +
 debian/dpkg.cron.daily             | 8 ++++----
 debian/dpkg.postinst               | 6 +++---
 debian/dpkg.postrm                 | 4 ++--
 run-script                         | 2 +-
 scripts/dpkg-maintscript-helper.sh | 4 ++--
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5f842d5b3..1bb837776 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium
   * Code internals:
     - dpkg-maintscript-helper: Use an explicit escape instead of a literal
       backslash.
+    - Quote shell variables. Reported by Johannes Schauer <[email protected]>.
   * Build system:
     - get-version: Use a format string with printf.
     - run-script: Use $() instead of deprecated ``.
diff --git a/debian/dpkg.cron.daily b/debian/dpkg.cron.daily
index 0a6b05e1d..62da81727 100644
--- a/debian/dpkg.cron.daily
+++ b/debian/dpkg.cron.daily
@@ -9,16 +9,16 @@ if cd /var/backups ; then
     dbchanged=no
     dbfiles="arch status diversions statoverride"
     for db in $dbfiles ; do
-        if ! cmp -s dpkg.${db}.0 $dbdir/$db ; then
+        if ! cmp -s "dpkg.${db}.0" "$dbdir/$db"; then
             dbchanged=yes
             break;
         fi
     done
     if [ "$dbchanged" = "yes" ] ; then
         for db in $dbfiles ; do
-            [ -e $dbdir/$db ] || continue
-            cp -p $dbdir/$db dpkg.$db
-            savelog -c 7 dpkg.$db >/dev/null
+            [ -e "$dbdir/$db" ] || continue
+            cp -p "$dbdir/$db" "dpkg.$db"
+            savelog -c 7 "dpkg.$db" >/dev/null
         done
     fi
 
diff --git a/debian/dpkg.postinst b/debian/dpkg.postinst
index e762b8a2c..5447d99a4 100755
--- a/debian/dpkg.postinst
+++ b/debian/dpkg.postinst
@@ -18,9 +18,9 @@ create_database() {
 # Create log file and set default permissions if possible
 create_logfile() {
     logfile=$DPKG_ROOT/var/log/dpkg.log
-    touch $logfile
-    chmod 644 $logfile
-    chown root:root $logfile 2>/dev/null || chown 0:0 $logfile
+    touch "$logfile"
+    chmod 644 "$logfile"
+    chown root:root "$logfile" 2>/dev/null || chown 0:0 "$logfile"
 }
 
 
diff --git a/debian/dpkg.postrm b/debian/dpkg.postrm
index e5658ceaa..175080e86 100755
--- a/debian/dpkg.postrm
+++ b/debian/dpkg.postrm
@@ -7,8 +7,8 @@ set -e
 remove_logfile() {
     logdir=$DPKG_ROOT/var/log
 
-    rm -f $logdir/dpkg.log $logdir/dpkg.log.* 2>/dev/null
-    rm -f $logdir/alternatives.log $logdir/alternatives.log.* 2>/dev/null
+    rm -f "$logdir"/dpkg.log "$logdir"/dpkg.log.* 2>/dev/null
+    rm -f "$logdir"/alternatives.log "$logdir"/alternatives.log.* 2>/dev/null
 }
 
 case "$1" in
diff --git a/run-script b/run-script
index c62183295..dc13a35a8 100755
--- a/run-script
+++ b/run-script
@@ -16,4 +16,4 @@ export DPKG_DATADIR="$cwd/data"
 script="$1"
 shift 1
 
-exec $PERL "$cwd/$script" "$@"
+exec "$PERL" "$cwd/$script" "$@"
diff --git a/scripts/dpkg-maintscript-helper.sh 
b/scripts/dpkg-maintscript-helper.sh
index d501307e1..2865a63d5 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -424,7 +424,7 @@ prepare_dir_to_symlink()
        # we should not perform the switch.
        export DPKG_MAINTSCRIPT_HELPER_INTERNAL_API="$version"
        find "$PATHNAME" -print0 | \
-               xargs -0 -n1 $0 _internal_pkg_must_own_file "$PACKAGE" || \
+               xargs -0 -n1 "$0" _internal_pkg_must_own_file "$PACKAGE" || \
                error "directory '$PATHNAME' contains files not owned by" \
                      "package $PACKAGE, cannot switch to symlink"
        unset DPKG_MAINTSCRIPT_HELPER_INTERNAL_API
@@ -568,7 +568,7 @@ COLOR_BOLD_WHITE=''
 
 setup_colors()
 {
-       : ${DPKG_COLORS=auto}
+       : "${DPKG_COLORS=auto}"
 
        case "$DPKG_COLORS" in
        auto)

-- 
Dpkg.Org's dpkg

Reply via email to