Hi Grail,

On 15/06/11 01:25, Grail Dane wrote:
> Hi James
> 
> Probably bad wording on my behalf.  Yes it was set prior to the configure 
> being called.
> My exact entries are:
> 
> CFLAGS=-DSHELL='\"/bin/bash\"' ./configure --prefix=/usr --exec-prefix= 
> --sysconfdir=/etc
> make
> make install
> 
> I have also exported the CFLAGS prior to the above and simply done configure, 
> make and make install
> steps
> but both yield the same results as shown previously, ie that the script 
> errors with unexpected token
> which implies that it is still running it as sh.

What does this show?:

        strings /path/to/upstart/source/init/init|grep ^/bin

I configured Upstart 1.3 exactly as you have above. I then created grail.conf 
(attached) as
/tmp/i/grail.conf, and ran the following in one terminal:

        $ init/init --confdir /tmp/i --no-sessions --no-startup-event --session 
--debug

And in another terminal:

        $ util/initctl --session start grail

This resulted in the file grail.log attached. On my Ubuntu system /bin/sh is 
symbolically linked to
/bin/dash but as shown in grail.log, bash is definitely being invoked.

Regards,

James.

> 
> So so far it has only been the here document process working for me :(
> 
> cheers
> grail
> 
>> Date: Tue, 14 Jun 2011 09:39:51 +0100
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]
>> Subject: Re: Process substitution into loop
>>
> On 14/06/11 04:49, Grail Dane wrote:
>> Well, I can confirm that setting the interpreter to /bin/sh does not support 
>> process substitution as
>> I have run the following script
>> under both:
> 
>> while read -r DEVICE
>> do
>> echo ip link set dev $DEVICE up
>> done< <(ip link | awk '/^[0-9]/ && gsub(/:/,""){print $2}')
> 
>> Under bash I get:
> 
>> ip link set dev lo up
>> ip link set dev eth0 up
>> ip link set dev sit0 up
> 
>> Under sh I get:
> 
>> line 6: syntax error near unexpected token `<'
>> line 6: `done< <(ip link | awk '/^[0-9]/ && gsub(/:/,""){print $2}')'
> 
>> I also have not been able to find a way to successfully implement the 
>> Cookbook option to change the
>> default shell.
>> To this end I mean that if I add the CFLAGS option prior to compiling,
> Hi Grail,
> 
> You need to set CFLAGS prior to running *configure* (before the compile). So, 
> you will need to do:
> 
> export CFLAGS=...
> ./configure ...
> make
> 
> Regards,
> 
> James.
> 
>> the output once running:
> 
>> start network-interfaces
> 
>> Yields the same type of error as the script above:
> 
>> /proc/self/fd/10: line 6: syntax error near unexpected token `<'
>> init: network-interfaces main process (27800) terminated with status 2
>> start: Job failed to start
> 
>> I can confirm that the here document idea does work so I am left with the 
>> fact that the CFLAGS
>> option
>> was some how no interpreted :(
> 
>> Once compiled and installed is there any way to check what shell it thinks 
>> is the default?
> 
>> Cheers
>> grail
> 
>> ----------------------------------------------------------------------------------------------------
>> Date: Mon, 13 Jun 2011 18:15:20 -0700
>> Subject: Re: FW: Process substitution into loop
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]
> 
>> Note the phrase *startup behaviour* in the paragraph - bash still supports 
>> bashisms in its scripts
>> when invoked as sh (after all, that's where the entire historical problem 
>> with them comes from)
> 
>> On Mon, Jun 13, 2011 at 4:56 PM, Grail Dane <[email protected] 
>> <mailto:[email protected]>>
>> wrote:
> 
>> Hi James
> 
>> Thanks very much for the reply. As you can probably guess the typo is in the 
>> email but not in
>> the actual script. I did further testing and as per the bash install 
>> instructions:
> 
>> *sh*
> 
> 
> 
>> A symlink to the *bash* program; when invoked as *sh*, *bash* tries to mimic 
>> the startup
>> behavior of historical versions of *sh* as closely as possible, while 
>> conforming to the POSIX
>> standard as well
> 
> 
> 
>> This would indicate that it is a bash builtin feature to use only POSIX 
>> compliant options.
>> So from the Cookbook you may need to edit the following from the section you 
>> pointed me to:
> 
>> If you wish to change this, you can either make /bin/sh a symbolic link to 
>> your chosen shell
> 
>> As this does not work as expected in this case and it may be similar for 
>> other shells to.
> 
>> I will try the workaround of adding it as the default shell in the build and 
>> let you know how it
>> goes :)
> 
>> Cheers
>> grail
> 
>> > Date: Fri, 10 Jun 2011 11:22:12 +0100
>> > From: [email protected] <mailto:[email protected]>
> 
>> > To: [email protected] <mailto:[email protected]>
>> > CC: [email protected] <mailto:[email protected]>
>> > Subject: Re: Process substitution into loop
>> >
>> > Hi Grail,
>> >
>> > On 10/06/11 05:46, Grail Dane wrote:
>> > >
>> > >
>> > >> Date: Thu, 9 Jun 2011 21:05:45 -0700
>> > >> From: [email protected] <mailto:[email protected]>
>> > >> To: [email protected] <mailto:[email protected]>
>> > >> CC: [email protected] 
>> > >> <mailto:[email protected]>
>> > >> Subject: Re: Process substitution into loop
>> > >>
>> > >> On Fri, Jun 10, 2011 at 03:53:15AM +0000, Grail Dane wrote:
>> > >> > Just wondering, as I can't find by googling, if it is at all possible 
>> > >> > to
>> > >> > do a processsubstitution into a while loop within an upstart script?
>> > >>
>> > >> > Example:
>> > >> > while read -r DEVICE
>> > >> > do
>> > >> > ip link set dev $DEVICE up
>> > >> > done< <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2})
>> > You have an error in your script: it is missing the closing tick (see 
>> > below).
>> >
>> > >>
>> > >> > When issuing the start command on the script I get:
>> > >> > /proc/self/fd/10: line 6: syntax error near unexpected '<'init:
>> > >> > network-interfaces main process (1367) terminated with status 2start: 
>> > >> > Job
>> > >> > failed to start Would appreciated if someone would identify if i have 
>> > >> > done
>> > >> > something wrong or if this not a supported feature?
>> > >>
>> > >> The <() syntax is not part of the POSIX standard, it's a bash extension.
>> > >> Upstart uses /bin/sh to interpret scripts, as is customary; chances are
>> > >> you're running on a system where /bin/sh is not bash, and as a result 
>> > >> this
>> > >
>> > > Actually /bin/sh is a symbolic link to bash on my system. Is there 
>> > > anyway to have bash as the
>> > > shell used?
>> >
>> > script
>> > /bin/bash <<EOT
>> > while read -r DEVICE
>> > do
>> > echo "DEBUG: ip link set dev $DEVICE up" > /tmp/grail.log
>> > done < <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}')
>> > EOT
>> > end script
>> >
>> > Also, just for you :)...
>> >
>> > http://upstart.ubuntu.com/cookbook/#changing-the-default-shell
>> >
>> > Regards,
>> >
>> > James.
>> >
>> > >
>> > >> syntax is not supported.
>> > >>
>> > >> A supported syntax would be:
>> > >>
>> > >> ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}' |
>> > >> while read -r DEVICE
>> > >> do
>> > >> ip link set dev $DEVICE up
>> > >> done
>> > >>
>> > >> --
>> > >> Steve Langasek Give me a lever long enough and a Free OS
>> > >> Debian Developer to set it on, and I can move the world.
>> > >> Ubuntu Developer http://www.debian.org/
>> > >> [email protected] <mailto:[email protected]> [email protected] 
>> > >> <mailto:[email protected]>
>> > >
>> >
> 
>> --
>> upstart-devel mailing list
>> [email protected] <mailto:[email protected]>
>> Modify settings or unsubscribe at: 
>> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
> 
> 
> 
> 
script
  exec >>/tmp/grail.log 2>&1
  set -x
  while read -r DEVICE
  do
    echo "ip link set dev $DEVICE up"
  done < <(ip link | awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}')
  set
  env
end script
+ read -r DEVICE
++ ip link
++ awk '/^[0-9]/ && !/UP/ && gsub(/:/,""){print $2}'
+ echo 'ip link set dev vboxnet0 up'
ip link set dev vboxnet0 up
+ read -r DEVICE
+ set
BASH=/bin/bash
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="/proc/self/fd/9")
BASH_VERSINFO=([0]="4" [1]="2" [2]="8" [3]="1" [4]="release" [5]="i686-pc-linux-gnu")
BASH_VERSION='4.2.8(1)-release'
DEVICE=
DIRSTACK=()
EUID=1000
GROUPS=()
HOSTNAME=azul
HOSTTYPE=i686
IFS=$' \t\n'
MACHTYPE=i686-pc-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/usr/sbin:/home/james/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PIPESTATUS=([0]="1")
PPID=25933
PS4='+ '
PWD=/
SHELL=/bin/bash
SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:xtrace
SHLVL=1
TERM=screen
UID=1000
UPSTART_INSTANCE=
UPSTART_JOB=grail
_=DEVICE
+ env
TERM=screen
PATH=/sbin:/usr/sbin:/home/james/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PWD=/
SHLVL=1
UPSTART_INSTANCE=
UPSTART_JOB=grail
_=/usr/bin/env
-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to