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=598e1b3e9c9b665829ea7c1b3ee157038708e14f

commit 598e1b3e9c9b665829ea7c1b3ee157038708e14f (HEAD -> master)
Author: Guillem Jover <[email protected]>
AuthorDate: Mon May 11 16:55:08 2020 +0200

    Use $() in shell or qx() in perl instead of ``
---
 debian/changelog                |  2 ++
 dselect/methods/disk/setup      |  8 ++++----
 dselect/methods/multicd/install | 14 +++++++-------
 dselect/methods/multicd/setup   | 30 +++++++++++++++---------------
 dselect/methods/multicd/update  |  2 +-
 man/dpkg-architecture.man       |  2 +-
 man/dpkg.man                    |  2 +-
 t/syntax.t                      |  2 +-
 8 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 30a41fe50..e72ee3503 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -56,6 +56,8 @@ dpkg (1.20.1) UNRELEASED; urgency=medium
     - man: Fix indentation for a note admonition in dpkg-scansources(1).
     - man: Document that a 3.0 (quilt) patch cannot create or modify symlinks.
       Thanks to Johannes Schauer <[email protected]>.
+  * Code internals:
+    - Use $() in shell or qx() in perl instead of ``.
   * Build system:
     - Handle .git being a plain file when getting the dpkg tree version.
     - Add debian/changelog as a Changes file to the CPAN distribution.
diff --git a/dselect/methods/disk/setup b/dselect/methods/disk/setup
index 6f0b6635f..9be7daac0 100755
--- a/dselect/methods/disk/setup
+++ b/dselect/methods/disk/setup
@@ -21,7 +21,7 @@ option=$3
 cd "$vardir/methods/disk"
 tp=/var/run/ddm$$
 
-iarch=`dpkg --admindir $vardir --print-architecture`
+iarch=$(dpkg --admindir $vardir --print-architecture)
 
 xit=1
 trap '
@@ -58,7 +58,7 @@ outputparam () {
        echo "$2" | sed -e "s/'/'\\\\''/; s/^/$1='/; s/$/'/" >&3
 }
 
-intrkey="`stty -a | sed -n 's/.*intr = \([^;]*\);.*/\1/p'`"
+intrkey="$(stty -a | sed -n 's/.*intr = \([^;]*\);.*/\1/p')"
 echo "
 If you make a mistake, use the interrupt key ($intrkey) to abort.
 "
@@ -150,7 +150,7 @@ since '$p_hierbase/main/binary-$iarch' doesn't seem to 
exist."
                break
        elif [ -d "$mountpoint/$response/main/binary-$iarch" ]
        then
-               hierbase="`echo \"$response\" | sed -e 's:/*$::; s:^/*:/:'`"
+               hierbase="$(echo \"$response\" | sed -e 's:/*$::; s:^/*:/:')"
                break
        fi
        echo \
@@ -230,7 +230,7 @@ Say 'none' if this area is not available."
                case "$response" in
                '' | none)      continue                ;;
                esac
-               check_binary $1 "`echo \"$response\" | sed -e 's:/$::; 
s:^/*:/:'`"
+               check_binary $1 "$(echo \"$response\" | sed -e 's:/$::; 
s:^/*:/:')"
        done
        if [ -n "$this_binary" ]
        then
diff --git a/dselect/methods/multicd/install b/dselect/methods/multicd/install
index 539c074eb..e4187d496 100755
--- a/dselect/methods/multicd/install
+++ b/dselect/methods/multicd/install
@@ -29,7 +29,7 @@ cd "$vardir/methods/$method"
 
 #debug() { echo "DEBUG: $@"; }
 debug() { true; }
-iarch=`dpkg --print-architecture`
+iarch=$(dpkg --print-architecture)
 ismulti() { test -e "$1/.disk/info" || test -e "$1$2/.disk/info"; }
 
 # 1/ mountpoint
@@ -38,11 +38,11 @@ getdisklabel () {
     debug "$1" "$2"
     if [ -f $1/.disk/info ]
     then
-       echo -n `head -1 "$1/.disk/info"`
+        echo -n $(head -1 "$1/.disk/info")
     else
         if [ -f $1$2/.disk/info ]
        then
-           echo -n `head -1 "$1$2/.disk/info"`
+            echo -n $(head -1 "$1$2/.disk/info")
        else
             echo -n 'Non-Debian disc'
        fi
@@ -71,14 +71,14 @@ do_mount() {
        fi
 }
 
-trap 'eval `do_umount`; exit $xit' 0
+trap 'eval $(do_umount); exit $xit' 0
 
-eval `do_mount`
+eval $(do_mount)
 
 predep="$vardir/predep-package"
 while true
 do
-       thisdisk="`getdisklabel ${p_mountpoint} ${p_hierbase}`"
+       thisdisk="$(getdisklabel ${p_mountpoint} ${p_hierbase})"
        set +e
        dpkg --predep-package >"$predep"
        rc=$?
@@ -280,7 +280,7 @@ done
 
        exit $ouch;
 
-' "$vardir" "$p_mountpoint" "$p_hierbase" "`do_mount`" "`do_umount`"
+' "$vardir" "$p_mountpoint" "$p_hierbase" "$(do_mount)" "$(do_umount)"
 
 
 echo -n 'Installation OK.  Hit RETURN.  '
diff --git a/dselect/methods/multicd/setup b/dselect/methods/multicd/setup
index 9c32bda10..46c89af2d 100755
--- a/dselect/methods/multicd/setup
+++ b/dselect/methods/multicd/setup
@@ -26,7 +26,7 @@ test -d "$vardir/methods/$method" || mkdir 
"$vardir/methods/$method"
 cd "$vardir/methods/$method"
 tp=/tmp/ddm$$
 
-iarch=`dpkg --print-architecture`
+iarch=$(dpkg --print-architecture)
 dist=stable
 
 xit=1
@@ -54,11 +54,11 @@ getdisklabel () {
     debug "$1" "$2"
     if [ -f $1/.disk/info ]
     then
-       echo -n `head -1 "$1/.disk/info"`
+        echo -n $(head -1 "$1/.disk/info")
     else
         if [ -f $1$2/.disk/info ]
        then
-           echo -n `head -1 "$1$2/.disk/info"`
+            echo -n $(head -1 "$1$2/.disk/info")
        else
             echo -n 'Non-Debian disc'
        fi
@@ -128,7 +128,7 @@ outputparam () {
 }
 
 ## MAIN
-intrkey="`stty -a | sed -n 's/.*intr = \([^;]*\);.*/\1/p'`"
+intrkey="$(stty -a | sed -n 's/.*intr = \([^;]*\);.*/\1/p')"
 echo "
 If you make a mistake, use the interrupt key ($intrkey) to abort.
 "
@@ -162,7 +162,7 @@ if [ $option = multi_cd ]
 then
        mount >$tp.m
        sed -n 's/ ([^)]*)$//; s/^[^ ]* on //; s/ type iso9660$//p' <$tp.m 
>$tp.l
-       ncdroms=`wc -l <$tp.l`
+       ncdroms=$(wc -l <$tp.l)
        if [ $ncdroms -gt 1 ]
        then
                response=""
@@ -174,11 +174,11 @@ then
                        echo -n \
        "Is it any of these ?  Type a number, or 'n' for none.  "
                        read response
-                       response="`echo \"$response\" | sed -e 's/[     ]*$//'`"
+                        response="$(echo \"$response\" | sed -e 's/[   ]*$//')"
                        if expr "$response" : '[0-9][0-9]*$' >/dev/null && \
                           [ $response -ge 1 -a $response -le $ncdroms ]
                        then
-                               mountpoint="`sed -n $response'p' <$tp.l`"
+                                mountpoint="$(sed -n $response'p' <$tp.l)"
                                echo
                        elif expr "$response" : '[Nn]' >/dev/null
                        then
@@ -189,10 +189,10 @@ then
                done
        elif [ $ncdroms = 1 ]
        then
-               mountpoint="`cat $tp.l`"
+               mountpoint="$(cat $tp.l)"
                perl -ne 'print if s/ type iso9660 \([^)]*\)$// && s/ on 
.*$//;' \
                        <$tp.m >$tp.d
-               blockdevice="`cat $tp.d`"
+               blockdevice="$(cat $tp.d)"
                yesno yes \
        "Found a CD-ROM: $blockdevice, mounted on $mountpoint. Is it the right 
one?"
                if [ $yesno = no ]
@@ -312,11 +312,11 @@ nor are you using a multi-CD set"
                break
        fi
 
-       hierbase="`echo \"$response\" | sed -e 's:/$::; s:^/*:/:; s:/\+:/:g;'`"
+       hierbase="$(echo \"$response\" | sed -e 's:/$::; s:^/*:/:; s:/\+:/:g;')"
        debug "hierbase: [$hierbase]"
 
        if [ -n "$multi" ]; then
-               disklabel=`getdisklabel "$mountpoint" "/$response"`
+               disklabel=$(getdisklabel "$mountpoint" "/$response")
                echo "Ok, this is disc"
                echo "    $disklabel"
                #echo "Updating multi CD contents file cache ..."
@@ -381,7 +381,7 @@ check_binary () {
        echo -n "Using '$this_binary' as $1 binary directory"
 
        if [ -n "$multi" ]; then
-               this_disk=`getdisklabel ${mountpoint} "/$hierbase"`
+               this_disk=$(getdisklabel ${mountpoint} "/$hierbase")
                echo " from disc"
                echo "    '$this_disk'"
        else
@@ -398,7 +398,7 @@ find_area () {
        this_disk=''
        if [ -n "$hierbase" ]
        then
-               check_binary $1 `echo "$hierbase/dists/$3/$1/binary-$iarch" | 
sed 's:/\+:/:g'`
+               check_binary $1 $(echo "$hierbase/dists/$3/$1/binary-$iarch" | 
sed 's:/\+:/:g')
                debug "THIS_BINARY $this_binary"
        fi
        if [ $option = multi_cd -a $2 = nf -a -z "$this_binary" ]
@@ -437,7 +437,7 @@ Say 'none' if this area is not available."
                case "$response" in
                '' | none)      continue                ;;
                esac
-               check_binary $1 "`echo \"$response\" | sed -e 's:/$::; 
s:^/*:/:'`"
+               check_binary $1 "$(echo \"$response\" | sed -e 's:/$::; 
s:^/*:/:')"
        done
        if [ -n "$this_binary" ]
        then
@@ -453,7 +453,7 @@ Say 'none' if this area is not available."
                        done
                else
                        if [ -f 
"${mountpoint}${hierbase}/.disk/packages/$1/Packages.gz" ]; then
-                               this_packages=`echo 
"${hierbase}/.disk/packages/$1/Packages.gz"|sed 's:/\+:/:g'`
+                               this_packages=$(echo 
"${hierbase}/.disk/packages/$1/Packages.gz"|sed 's:/\+:/:g')
                                echo "Using '${this_packages}' for $1."
                        fi
                fi
diff --git a/dselect/methods/multicd/update b/dselect/methods/multicd/update
index a2261d706..e32683907 100755
--- a/dselect/methods/multicd/update
+++ b/dselect/methods/multicd/update
@@ -20,7 +20,7 @@ set -e
 vardir="$1"
 method=$2
 option=$3
-iarch=`dpkg --print-architecture`
+iarch=$(dpkg --print-architecture)
 
 cd "$vardir/methods/$method"
 
diff --git a/man/dpkg-architecture.man b/man/dpkg-architecture.man
index 506b2f561..86534836f 100644
--- a/man/dpkg-architecture.man
+++ b/man/dpkg-architecture.man
@@ -293,7 +293,7 @@ CC=i386\-gnu\-gcc dpkg\-architecture \-c debian/rules build
 .EE
 .IP
 .EX
-eval \`dpkg\-architecture \-u\`
+eval $(dpkg\-architecture \-u)
 .EE
 .PP
 Check if the current or specified host architecture is equal to an
diff --git a/man/dpkg.man b/man/dpkg.man
index 561775fa8..74804c86e 100644
--- a/man/dpkg.man
+++ b/man/dpkg.man
@@ -1136,7 +1136,7 @@ apt\-cache dumpavail | dpkg \-\-merge\-avail
 or with dpkg 1.17.6 and earlier:
 .RS
 .EX
-avail=`mktemp`
+avail=$(mktemp)
 apt\-cache dumpavail >"$avail"
 dpkg \-\-merge\-avail "$avail"
 rm "$avail"
diff --git a/t/syntax.t b/t/syntax.t
index 4dfe63df7..fc20f6c12 100644
--- a/t/syntax.t
+++ b/t/syntax.t
@@ -34,7 +34,7 @@ my $PERL = $ENV{PERL} // $^X // 'perl';
 sub syntax_ok {
     my $file = shift;
 
-    my $eval = `$PERL -cw \"$file\" 2>&1`;
+    my $eval = qx($PERL -cw \"$file\" 2>&1);
     my $ok = ($eval =~ s{^\Q$file\E syntax OK\n$}{}ms) && length $eval == 0;
 
     ok($ok, "Compilation check $file");

-- 
Dpkg.Org's dpkg

Reply via email to