Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
Sean McGrath - Sun Microsystems Ireland wrote: This is the Asterisk PBX right ? It is. Asterisk seems to be dependant on gnu utils rather than posix compliant utils. Yeah. Changing the set of used utilities is not a problem and with little tweaking I always manage to compile the thing. H

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Sean McGrath - Sun Microsystems Ireland
Josip Gracin stated: < Shawn Walker wrote: < >POSIX requires that you get a POSIX shell if you type "sh" after you < >did setup a POSIX compliant PATH" < > < >So, there's nothing disturbing about this at all. < < Shawn, I would appreciate an advice on the following situation then: < < I'm trying

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
Steven Sim wrote: But I have been telling (shouting actually) people to ALWAYS ALWAYS start their scripts with a #! Forgive me if I am totally off topic here, but are you guys (and gals?) saying that it is not necessary?? Well, not exactly. But there exists a problem which sometimes, in

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Steven Sim
Hi All; Please forgive me for butting in. But I have been telling (shouting actually) people to ALWAYS ALWAYS start their scripts with a #! Forgive me if I am totally off topic here, but are you guys (and gals?) saying that it is not necessary?? Warmest Regards Steven Sim Darren J Mof

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Javier Augusto
Greetings, > I'm trying to port a software called Asterisk to Solaris. The software > uses XPG4-compliant shell scripts in its build process. [..] I have an Asterisk Server running on top of Solaris 10 SPARC from which I have succesfully installed from cvs. I don't remember having to change any

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Frank Hofmann
On Mon, 3 Jul 2006, Joerg Schilling wrote: Darren J Moffat <[EMAIL PROTECTED]> wrote: BTW: we then would need a syscall to set up the user's POSIX compliance level. Why does it need to be a syscall ? Because (if you like to handle #! in the kernel as before) the kernel needs to know the PA

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Joerg Schilling
Darren J Moffat <[EMAIL PROTECTED]> wrote: > > BTW: we then would need a syscall to set up the user's POSIX compliance > > level. > > Why does it need to be a syscall ? Because (if you like to handle #! in the kernel as before) the kernel needs to know the PATH to the right shell. Jörg -- E

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Joerg Schilling
[EMAIL PROTECTED] wrote: > What's the effect of .POSIX in the makefiles? (That is sufficient for > "make" and derivatives on Solaris. But it's not sifficient for gmake.) gmake is inherently POSIX incompatible as it's makefile parser is wrong. Jörg -- EMail:[EMAIL PROTECTED] (home) Jörg Schi

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Darren J Moffat
Joerg Schilling wrote: Frank Hofmann <[EMAIL PROTECTED]> wrote: A file which starts with #!/path/to/interpreter, is technically an implementation defined file. Is the "empty" #! (no explicit pathname given) ok ? This sounds like a very interesting idea! You should have mentioned in the prev

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>[EMAIL PROTECTED] wrote: >> I can't be sure what make does, but if a script is executable and starts >> with ":" or even just "#" the shell will fail the exec and will run >> the script with $SHELL script. > >Indeed, this is one solution! If I remove #! from all scripts, >determine the XPG4-com

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
[EMAIL PROTECTED] wrote: I can't be sure what make does, but if a script is executable and starts with ":" or even just "#" the shell will fail the exec and will run the script with $SHELL script. Indeed, this is one solution! If I remove #! from all scripts, determine the XPG4-compliant shel

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Joerg Schilling
Frank Hofmann <[EMAIL PROTECTED]> wrote: > > A file which starts with #!/path/to/interpreter, is technically an > > implementation defined file. > > Is the "empty" #! (no explicit pathname given) ok ? This sounds like a very interesting idea! You should have mentioned in the previous POSIX discu

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>if [ -x /usr/xpg4/bin/sh -a "$_" != /usr/xpg4/bin/sh ]; then > exec /usr/xpg4/bin/sh $0 $* Certainly you will need: > exec /usr/xpg4/bin/sh $0 "$@" But you can't test on $_ in shell scripts. Casper ___ opensolaris-discuss mailing li

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>Is the "empty" #! (no explicit pathname given) ok ? Anything which cases "execve" to return ENOEXEC is fair game. >How would I select, as admin/user, which 'default' that'd evaluate to ? You don't; because a POSIX compliant shell will run such a script in a POSIX compliant shell all you need t

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Darren J Moffat
Josip Gracin wrote: [EMAIL PROTECTED] wrote: But first tell us what exactly is standards complaint about: #!/bin/sh Please note that I did NOT claim this to be either standard or correct in any of my posts, nor do I require for this to remain in the scripts. It can be changed. Probab

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Frank Hofmann
On Mon, 3 Jul 2006 [EMAIL PROTECTED] wrote: I am not sure I understand you correctly. Are you suggesting that I should avoid #! and use explicit invocation of shell interpreter to run scripts? If you want to have a bigger chance of executing the script in a POSIX shell. This is the only wa

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>I am not sure I understand you correctly. Are you suggesting that I >should avoid #! and use explicit invocation of shell interpreter to run >scripts? If you want to have a bigger chance of executing the script in a POSIX shell. This is the only way the standard provides for executing script

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
[EMAIL PROTECTED] wrote: But first tell us what exactly is standards complaint about: #!/bin/sh Please note that I did NOT claim this to be either standard or correct in any of my posts, nor do I require for this to remain in the scripts. It can be changed. Probably, if you want t

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>Shawn Walker wrote: >> POSIX requires that you get a POSIX shell if you type "sh" after you >> did setup a POSIX compliant PATH" >> >> So, there's nothing disturbing about this at all. > >Shawn, I would appreciate an advice on the following situation then: > >I'm trying to port a software called

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
Shawn Walker wrote: POSIX requires that you get a POSIX shell if you type "sh" after you did setup a POSIX compliant PATH" So, there's nothing disturbing about this at all. Shawn, I would appreciate an advice on the following situation then: I'm trying to port a software called Asterisk to So

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Casper . Dik
>> I have several standard-compliant shell scripts. >> These scripts use >> #!/bin/sh'. However, since /bin/sh on Solaris is not >> >> standard-compliant, these scripts fail. > >How very interesting. Would you please list what exactly is it that fails, >best with the snippets of code that fa

Re: [osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-03 Thread Josip Gracin
UNIX admin wrote: >> I have several standard-compliant shell scripts. >> These scripts use >> #!/bin/sh'. However, since /bin/sh on Solaris is not >> >> standard-compliant, these scripts fail. > > How very interesting. Would you please list what exactly is it that fails, best with the snippets

[osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-02 Thread UNIX admin
> I have several standard-compliant shell scripts. > These scripts use > #!/bin/sh'. However, since /bin/sh on Solaris is not > > standard-compliant, these scripts fail. How very interesting. Would you please list what exactly is it that fails, best with the snippets of code that fail? Th

[osol-discuss] Re: How to write portable scripts in Solaris?

2006-07-02 Thread Shawn Walker
> Joerg Schilling wrote: > > Josip Gracin <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> You could make the first line of the scripts: > >>> #!/usr/bin/env sh > >> That is what I thought. Shouldn't this become the > law then? ;-) I > > > > No, because it opens security issues.