WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH][TOOLS] libfsimage: portability fixes

To: Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH][TOOLS] libfsimage: portability fixes
From: Aron Griffis <aron@xxxxxx>
Date: Thu, 27 Mar 2008 11:05:31 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 27 Mar 2008 08:04:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200803261514.33378.Christoph.Egger@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <200803261514.33378.Christoph.Egger@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.17 (2007-11-01)
Christoph Egger wrote:  [Wed Mar 26 2008, 10:14:33AM EDT]
> diff -r 966c04d42e94 tools/libfsimage/Makefile
> --- a/tools/libfsimage/Makefile       Wed Mar 26 09:12:57 2008 +0000
> +++ b/tools/libfsimage/Makefile       Wed Mar 26 17:12:55 2008 +0100
> @@ -2,7 +2,7 @@ include $(XEN_ROOT)/tools/Rules.mk
>  include $(XEN_ROOT)/tools/Rules.mk
>  
>  SUBDIRS-y = common ufs reiserfs iso9660 fat
> -SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs)
> +SUBDIRS-y += $(shell $(SHELL) env CC="$(CC)" ./check-libext2fs)

As Ian asked, what was this intended to do?  It's certainly
wrong:

$ /bin/sh env CC=gcc ./check-libext2fs 
/usr/bin/env: /usr/bin/env: cannot execute binary file

> diff -r 966c04d42e94 tools/libfsimage/check-libext2fs
> --- a/tools/libfsimage/check-libext2fs        Wed Mar 26 09:12:57 2008 +0000
> +++ b/tools/libfsimage/check-libext2fs        Wed Mar 26 17:12:55 2008 +0100
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  
>  cat >ext2-test.c <<EOF
>  #include <ext2fs/ext2fs.h>
> @@ -9,7 +9,9 @@ int main()
>  }
>  EOF
>  
> -${CC:-gcc} -o ext2-test ext2-test.c -lext2fs >/dev/null 2>&1
> +if test -z ${CC}; then CC="gcc"; fi
> +${CC} -o ext2-test ext2-test.c -lext2fs >/dev/null 2>&1
> +
>  if [ $? = 0 ]; then
>       echo ext2fs-lib
>  else

This prevents check-libext2fs from being run outside the
Makefile.  It will silently fail compilation if $CC isn't set.
For Bourne shell and cross-platform compatibility, it should be:

${CC-cc} -o ext2-test ext2-test.c -lext2fs >/dev/null 2>&1

Aron

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel