[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.