build: fix test for --nocompress option
authorJim Meyering <jim@meyering.net>
Wed, 29 Jul 2009 20:50:44 +0000 (22:50 +0200)
committerRichard Jones <rjones@redhat.com>
Thu, 30 Jul 2009 08:42:17 +0000 (09:42 +0100)
The test for febootstrap-to-initramfs' --nocompress option
was always failing for me on F11.  Here's why:

  $ bash                               ~/w/co/libguestfs:210-comment-fix
  $ t=`febootstrap-to-initramfs 2>&1`
  [Exit 1]
  $ if ! echo $t|grep -sq -- --nocompress; then echo not found; fi
  not found

Notice: without quotes, the [--nocompress] term expands to "k",
because I happen to have a temporary file named "k":

  $ echo $t
  Usage: febootstrap-to-initramfs [--files=filelist] k DIR Please read
  febootstrap-to-initramfs(8) man page for more information.
  $ echo "$t"
  Usage: febootstrap-to-initramfs [--files=filelist] [--nocompress] DIR
  Please read febootstrap-to-initramfs(8) man page for more information.

a simpler example gives a clue:

  $ touch a b c
  $ echo [--z]
  a b c
  $ echo [--a]
  a
  $ echo [--b]
  a b

it's interpreting [--nocompress] as a range: "-" through "n", plus
the other characters, ocmpres.  "k" falls in the --n range.

Anyhow, here's the fix:

>From 84855642ed41828d01d55123cfab8d8dede759c1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 29 Jul 2009 16:33:02 -0400
Subject: [PATCH] build: fix test for --nocompress option

* configure.ac: Fix underquoting bug that would cause the test
for febootstrap-to-initramfs' --nocompress option always to fail
with certain-letter-named files in the top directory.

configure.ac

index 0ae20be..6bdf7d4 100644 (file)
@@ -264,7 +264,7 @@ version of febootstrap.
     AC_MSG_CHECKING([for --nocompress support in $FEBOOTSTRAP_TO_INITRAMFS])
     out=`$FEBOOTSTRAP_TO_INITRAMFS 2>&1 ||:`
     echo "febootstrap_to_initramfs test command output: $out" >&AS_MESSAGE_LOG_FD
-    if ! echo $out | grep -sq -- "--nocompress" ; then
+    if ! echo "$out" | grep -sq -e --nocompress ; then
         AC_MSG_RESULT([no])
        AC_MSG_FAILURE(
 [febootstrap-to-initramfs does not support the --nocompress option.