public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [JAVA] /bin/sh portability issues in scripts/jar.in
@ 2006-07-07  4:53 Roger Sayle
  2006-07-07  6:34 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Sayle @ 2006-07-07  4:53 UTC (permalink / raw)
  To: java-patches; +Cc: gcc-patches, Paolo Bonzini


The following patch is the third in the series to allow use of the
native /bin/sh on Solaris/x86.  These changes allow Paolo Bonzini's
impressive "jar" script to be used to build libjava on i386-pc-solaris2.10.

The change to the function "copy" replaces the use of the test's "-e"
operator, which isn't available on solaris, with the more portable "-f".
The second change avoid the "mkdir_p: command not found" error messages.
I'm not sure whether the disambiguation of the shell function and the
shell variable identifiers is necessary, but it was the first thing I
tried.  However placing the opening brace of the function declaration
on the same line seemed to ultimately resolve the failures I was seeing.


Tested on i386-pc-solaris2.10 with a full top-level "make bootstrap",
which gets further with these changes than without.



2006-07-06  Roger Sayle  <roger@eyesopen.com>

	* scripts/jar.in (copy): Use "test -f ..." instead of "test -e"
	for improved portability.
	(mkdir_p): Rename as mkdir_p_fun to disambiguate from the shell
	variable of the same name.  Make sure the open brace is on the same
	line as the function declaration.
	Set the mkdir_p shell variable to value "mkdir_p_fun".


Index: scripts/jar.in
===================================================================
*** scripts/jar.in	(revision 115223)
--- scripts/jar.in	(working copy)
*************** copy () {
*** 96,102 ****
        return 0
      fi

!     if test -e "$2"/"$1"; then
        error "$1": Duplicate entry.
      fi
      dir=`dirname "$1"`
--- 96,102 ----
        return 0
      fi

!     if test -f "$2"/"$1"; then
        error "$1": Duplicate entry.
      fi
      dir=`dirname "$1"`
*************** jar_list_verbose () {
*** 249,256 ****
  }

  # mkdir -p emulation based on the mkinstalldirs script.
! mkdir_p ()
! {
    for file
    do
      case $file in
--- 249,255 ----
  }

  # mkdir -p emulation based on the mkinstalldirs script.
! mkdir_p_fun () {
    for file
    do
      case $file in
*************** mkdir_p ()
*** 290,296 ****
  if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
    mkdir_p='mkdir -p'
  else
!   mkdir_p='mkdir_p'
    test -d ./-p && rmdir ./-p
    test -d ./--version && rmdir ./--version
  fi
--- 289,295 ----
  if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
    mkdir_p='mkdir -p'
  else
!   mkdir_p='mkdir_p_fun'
    test -d ./-p && rmdir ./-p
    test -d ./--version && rmdir ./--version
  fi


Roger
--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [JAVA] /bin/sh portability issues in scripts/jar.in
  2006-07-07  4:53 [JAVA] /bin/sh portability issues in scripts/jar.in Roger Sayle
@ 2006-07-07  6:34 ` Paolo Bonzini
  2006-07-07 10:56   ` Ralf Wildenhues
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2006-07-07  6:34 UTC (permalink / raw)
  To: Roger Sayle; +Cc: java-patches, gcc-patches, Paolo Bonzini

Roger Sayle wrote:
> The following patch is the third in the series to allow use of the
> native /bin/sh on Solaris/x86.  These changes allow Paolo Bonzini's
> impressive "jar" script to be used to build libjava on i386-pc-solaris2.10.
>   
Thanks.
> The change to the function "copy" replaces the use of the test's "-e"
> operator, which isn't available on solaris, with the more portable "-f".
>   
Note that there is another "test -e" a couple of lines below: in fact it 
is safe to convert the one you changed to "test -f", but not the other 
one.  That one would give a wrong error message if changed.  But it is 
only triggered when there are errors, so we can live with it.
> The second change avoid the "mkdir_p: command not found" error messages.
>   
If I get to choose, I'd prefer _mkdir_p.

My 2 cents,

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [JAVA] /bin/sh portability issues in scripts/jar.in
  2006-07-07  6:34 ` Paolo Bonzini
@ 2006-07-07 10:56   ` Ralf Wildenhues
  0 siblings, 0 replies; 3+ messages in thread
From: Ralf Wildenhues @ 2006-07-07 10:56 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Roger Sayle, java-patches, gcc-patches, Paolo Bonzini, autoconf-patches

[ http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00302.html ]

Hello Paolo,

* Paolo Bonzini wrote on Fri, Jul 07, 2006 at 08:33:55AM CEST:
> Roger Sayle wrote:
> >
> >The second change avoid the "mkdir_p: command not found" error messages.
> >  
> If I get to choose, I'd prefer _mkdir_p.

I'd suggest func_mkdir_p.  And this (the fact that shell functions
should not share a name space with variables, exposed with Solaris sh)
should be mentioned in the Autoconf portability section.

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-07 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07  4:53 [JAVA] /bin/sh portability issues in scripts/jar.in Roger Sayle
2006-07-07  6:34 ` Paolo Bonzini
2006-07-07 10:56   ` Ralf Wildenhues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).