[pbuilder] 02/02: pbuilder-modules: Fix DEBBUILDOPTS parsing when it contains quotes around spaces

James Clarke jrtc27 at moszumanska.debian.org
Sun Jun 18 17:14:28 UTC 2017


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

jrtc27 pushed a commit to branch master
in repository pbuilder.

commit b9f5d15e5d08e90f6bd4ea3fbe980708b4d27944
Author: James Clarke <jrtc27 at debian.org>
Date:   Sun Jun 18 18:13:37 2017 +0100

    pbuilder-modules: Fix DEBBUILDOPTS parsing when it contains quotes around spaces
    
    Closes: #865009
---
 pbuilder-modules | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index fb1fba6..b602ed3 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -961,10 +961,12 @@ b paraloop' \
 function get_changes_options() {
     local changes_options
     local arg
-    for arg in $DEBBUILDOPTS; do
-        # De-escape arg. $(echo $arg) on its own doesn't perform quote
-        # expansion, since quote expansion operates on the *original* word.
-        eval arg="$arg"
+    # Split and de-escape DEBBUILDOPTS. Can't iterate over it before
+    # de-escaping, as word splitting does not take quotes in the variable into
+    # account. Need eval as $(echo $DEBBUILDOPTS) on its own doesn't perform
+    # quote expansion, since quote expansion operates on the *original* word.
+    eval local args=($DEBBUILDOPTS)
+    for arg in "${args[@]}"; do
         case $arg in
             -s[iad]|-v*|-m*|-e*|-C*)
                 changes_options="${changes_options:+$changes_options }'$arg'"
@@ -987,10 +989,12 @@ function get_changes_options() {
 function should_clean_source() {
     local noclean=0
     local arg
-    for arg in $DEBBUILDOPTS; do
-        # De-escape arg. $(echo $arg) on its own doesn't perform quote
-        # expansion, since quote expansion operates on the *original* word.
-        eval arg="$arg"
+    # Split and de-escape DEBBUILDOPTS. Can't iterate over it before
+    # de-escaping, as word splitting does not take quotes in the variable into
+    # account. Need eval as $(echo $DEBBUILDOPTS) on its own doesn't perform
+    # quote expansion, since quote expansion operates on the *original* word.
+    eval local args=($DEBBUILDOPTS)
+    for arg in "${args[@]}"; do
         case $arg in
             --pre-clean)
                 noclean=0
@@ -1007,10 +1011,12 @@ function should_clean_source() {
 function get_source_options() {
     local source_options
     local arg
-    for arg in $DEBBUILDOPTS; do
-        # De-escape arg. $(echo $arg) on its own doesn't perform quote
-        # expansion, since quote expansion operates on the *original* word.
-        eval arg="$arg"
+    # Split and de-escape DEBBUILDOPTS. Can't iterate over it before
+    # de-escaping, as word splitting does not take quotes in the variable into
+    # account. Need eval as $(echo $DEBBUILDOPTS) on its own doesn't perform
+    # quote expansion, since quote expansion operates on the *original* word.
+    eval local args=($DEBBUILDOPTS)
+    for arg in "${args[@]}"; do
         case $arg in
             -s[nsAkurKUR]|-z*|-Z*|-i*|-I*)
                 source_options="${source_options:+$source_options }'$arg'"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git



More information about the Pbuilder-maint mailing list