diff mbox

[xfstests-bld] setup-buildchroot: fix finding files in chroot.d

Message ID 20170831201540.32597-1-ebiggers3@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Biggers Aug. 31, 2017, 8:15 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

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.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 setup-buildchroot | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Eric Biggers Sept. 16, 2017, 4 a.m. UTC | #1
On Thu, Aug 31, 2017 at 01:15:40PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Sept. 16, 2017, 6:34 a.m. UTC | #2
On Fri, Sep 15, 2017 at 09:00:08PM -0700, Eric Biggers wrote:
> On Thu, Aug 31, 2017 at 01:15:40PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > 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!

Applied, thanks.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/setup-buildchroot b/setup-buildchroot
index a556894..2340eb5 100755
--- a/setup-buildchroot
+++ b/setup-buildchroot
@@ -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
 }