Danek Duvall wrote:
> On Wed, Nov 14, 2007 at 01:04:50AM +0100, Roland Mainz wrote:
> > > +all: $(VER)/makefile
> > > +   (cd $(VER); env \
> > > +       LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \
> > > +       MAKE=/usr/ccs/bin/make \
> > > +       /usr/ccs/bin/make -e all3)
> > > +   @find . -name core -exec rm -f {} \;
> >
> > AFAIK it may be nice to add "-xstrconst" to CFLAGS and check whether the
> > suggestions in
> > http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6628305 make
> > any difference for this application.
> 
> I was actually completely unable to get p7zip to build with Studio.

Uhm... you're using gcc ?

> It's
> mostly in C++, and is a horrendous pile that I don't want to start to try
> to fix as long as it works.  So while I might investigate this, I think it
> would be a good deal of work, and given that it works as-is, I'd like to
> defer that investigation, or pass it off to someone who's more passionate
> about it than I.

AFAIK /usr/SUNWspro/bin/CC's equivalent for "-xstrconst" is
"-features=conststrings" ... but AFAIK it should already be the default
if the compiler runs in the normal mode.

[snip]
> > General note for this type of script: Please add a $ set -o errexit # at
> > the beginning that the script - the "errexit" flag causes the shell to
> > immediately abort the script when it hits a command which returns a
> > failure instead of continuing operation (and maybe running amok (and
> > ordering 12 refurbished F/A-18B via your EBay-account etc. =:-) ))
> 
> This violates the spirit of "make -k" which is the default -- do as much
> work as is possible even if there are failures.

Erm, it's against normal "Makefile" behaviour, e.g. "stop with an error
when a target fails" - and that's IMO exactly what should happen for
this script, too (remeber when "make" lanuches a shell to execute
commands it calls it with "sh -e" (or better: "$(SHELL) -e") which is
the same as the "errexit" flag). If any of the install/copy/etc.
sub-scripts/commands/etc. fails then the the target as whole cannot be
completed. The only other solution is to put $ if mycmd then
print_error_and_exit ; fi # over the whole script to catch all possible
sources of errors.

BTW: See
http://cr.opensolaris.org/~rkamboj/MySQLWebRev/usr/src/cmd/mysql-5-0/install-mysql.html
,
http://cr.opensolaris.org/~dermot/tcltk64-05/usr/src/lib/tcl/install-sfw.udiff.html
and so on...

> And if there are any
> failures, none of the commands are dependent on previous ones having
> succeeded, so it makes sense to keep on going.

Erm... why ? If an installation of a component failed then there is
something wrong and the problem needs to be fixed. AFAIK that's the
normal procedure for Makefiles, even if the stuff was "offloaded" into
this seperate script.

[snip]
> > > +. ${SRC}/tools/install.subr
> >
> > Plese change this to...
> > -- snip --
> > source "${SRC}/tools/install.subr"
> > -- snip --
> 
> ksh(88) doesn't mention this in its manpage?

Grumpf... you're right... from what I can see in the history it seems it
was added by ksh93 somewhere around version 'e', some ksh88
versions+bash "cloned" that feature and per
http://www.opengroup.org/onlinepubs/000095399/idx/sbi.html it's
currently not mandatory... ;-/

> > > +cd ${VERS}
> > > +
> > > +for f in bin/7z bin/7za bin/7zr; do
> > > +       _install E $f $BINDIR/${f#*/} 555
> >
> > Please use quotes, e.g. change this to...
> > -- snip --
> > _install E "$f" "$BINDIR/${f#*/}" 555
> > -- snip --
> 
> No.  There's zero reason to unless the shell is going crazy.  Which ksh
> doesn't do, right?  :)

Erm, it depends. If the variables contain an unexpected value (e.g.
error output of a command... or something like a usage message (e.g. the
idea is to harden the scripts against unexpected behaviour)) then it
will become a problem (usually the kind of problem which has teeth) -
and it even becomes worse since the script won't stop unless you use
"set -o errexit" as suggested above... ;-(

Just curious: What should "catch" malfunctions in the script when you
don't use the "errexit" flag ? Is there anything which will prevent
"rubble" from being shipped with the product ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to