ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Sudell <asud...@Op.Net>
Subject Shell portability
Date Tue, 08 Feb 2000 23:08:10 GMT
I had made a post last week about shell portability, that didn't
generate much of a reply.  I'm assuming that it is desirable for Ant to
build cleanly on as wide a range of systems as possible.  I've now seen
a second ksh-ism or posix-ism show up.

I've included a patch below that works around them.  One might argue that
"we require ksh" and that might be reasonable in the case of bootstrap.sh.
In the case of AntRun, which begins with a "#! /bin/sh", it's pretty clear
that it is intended to work in the Borne shell.

At least on Solaris 7 (with bin and not /usr/xpg4 in my path) both scripts
fail.  AntRun fails with a "test argument expected" and bootstrap.sh exits
with a "! not found".


Index: bootstrap.sh
===================================================================
RCS file: /home/cvspublic/jakarta-ant/bootstrap.sh,v
retrieving revision 1.6
diff -c -r1.6 bootstrap.sh
*** bootstrap.sh	2000/02/08 03:43:09	1.6
--- bootstrap.sh	2000/02/08 22:43:58
***************
*** 21,27 ****
  java org.apache.tools.ant.Main main
  java org.apache.tools.ant.Main clean 
  
! if ! test -e bin; then mkdir bin; fi
  cp src/bin/antRun bin
  chmod +x bin/antRun
  
--- 21,27 ----
  java org.apache.tools.ant.Main main
  java org.apache.tools.ant.Main clean 
  
! if test ! -d bin; then mkdir bin; fi
  cp src/bin/antRun bin
  chmod +x bin/antRun
  
Index: src/bin/antRun
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/bin/antRun,v
retrieving revision 1.3
diff -c -r1.3 antRun
*** antRun	2000/01/30 16:20:24	1.3
--- antRun	2000/02/08 22:43:59
***************
*** 6,12 ****
  shift
  shift
  
! if test -e $CMD.sh; then
    CMD="sh $CMD.sh"
  fi
  
--- 6,12 ----
  shift
  shift
  
! if test -f $CMD.sh; then
    CMD="sh $CMD.sh"
  fi
  

-- 
    Drew Sudell        asudell@acm.org         http://www.op.net/~asudell


Mime
View raw message