Skip to contentSkip to conversation

setup-buildchroot: fix finding files in chroot.d

PATCH Applied Eric Biggers 2 participants 3 messages Aug 31, 2017 – Sep 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setup-buildchroot: fix finding files in chroot.d

From: Eric Biggers <[email protected]>

get_schroot_config() sometimes didn't find the files in /etc/schroot/chroot.d/ because there was a typo in the regex: it used [0-09] instead of [0-9]. Fix it, and also cat schroot.conf first so that it doesn't get printed multiple times by the xargs command.

We also don't need to check whether schroot.conf exists, since it was already checked in check_prerequisites(), and the 'cat' command would fail anyway if it didn't exist.

---
 setup-buildchroot | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
setup-buildchroot +3 -10
index a556894..2340eb5 100755
@@ -361,21 +361,14 @@ validate_binfmt_misc()
 # the chroot.d directory
 get_schroot_config()
 {
-    local files
-
-    if test ! -f $SCHROOT_CONFFILE
-    then
-	die $SCHROOT_CONFFILE does not exist
-    fi
+    cat $SCHROOT_CONFFILE
 
     if test -d $SCHROOT_CHROOT_D
     then
 	(cd $SCHROOT_CHROOT_D ;
 	 find . -maxdepth 1 -type f |
-	     egrep '^./[a-ZA-Z0-09_-][a-ZA-Z0-09_.-]*$' |
-	     xargs cat $SCHROOT_CONFFILE)
-    else
-	cat $SCHROOT_CONFFILE
+	     egrep '^./[a-ZA-Z0-9_-][a-ZA-Z0-9_.-]*$' |
+	     xargs cat)
     fi
 }
 
Signature · 1 line
2.14.1.581.gf28d330327-goog
#1 lore raw
Quoted 11 lines · Eric Biggers

From: Eric Biggers <[email protected]>

get_schroot_config() sometimes didn't find the files in /etc/schroot/chroot.d/ because there was a typo in the regex: it used [0-09] instead of [0-9]. Fix it, and also cat schroot.conf first so that it doesn't get printed multiple times by the xargs command.

We also don't need to check whether schroot.conf exists, since it was already checked in check_prerequisites(), and the 'cat' command would fail anyway if it didn't exist.

Ted, can you apply this patch? Thanks!

Eric

#2 lore raw
Quoted 8 lines · Eric Biggers
Quoted 7 lines · Eric Biggers

From: Eric Biggers <[email protected]>

get_schroot_config() sometimes didn't find the files in /etc/schroot/chroot.d/ because there was a typo in the regex: it used [0-09] instead of [0-9]. Fix it, and also cat schroot.conf first so that it doesn't get printed multiple times by the xargs command.

Quoted 6 lines
Quoted 4 lines

We also don't need to check whether schroot.conf exists, since it was already checked in check_prerequisites(), and the 'cat' command would fail anyway if it didn't exist.

Ted, can you apply this patch? Thanks!

Applied, thanks.

- Ted