[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trouble with emacs-install script



Damyan Ivanov <divanov@creditreform.bg> wrote:

> Peter S Galbraith wrote:
> > Hi all,
> > 
> > I'd appreciate some shell-script help.
> > 
> > I'm trying to add a `grep' for byte-compilation warnings to
> > emacs-install scripts.
> > 
> > The file /usr/lib/emacsen-common/packages/install/emacs-goodies-el
> > would end with:
> > 
> > ---
> > echo ${FLAVOR} ${FLAGS} ${FILES} >> ${LOG}
> > "${FLAVOR}" ${FLAGS} ${FILES} >> ${LOG} 2>&1
> > egrep -s -e "While compiling|\*\*" ${LOG}
> > echo install/${PACKAGE}: Deleting ${LOG}
> > rm -f path.el ${LOG}
> > 
> > exit 0
> > ---
> 
> What is the purpose of the egrep line?

Displaying only byte-compilation warnings rather than all the
"all-is-fine" junk.  To be honest, this is in request to a bug report
because I don't feel it's very "useful" for the end-user either.
 
> To me it seems that egrep fails to find a match for the pattern and
> exits with non-zero status. 

Makes sense.  I looked for an option to egrep to avoid that (the reason
for trying "-s").

>                             If the script has "set -e", then a non-zero
> exit status of a command causes the whole script to exit with the same
> non-zero exit status, signalling to dpkg that something failed.

So I use use `unset -e' prior to the egrep and `set -e' right afterwards?
 
> Maybe you should use something like
> 
> ---
> echo ${FLAVOR} ${FLAGS} ${FILES} >> ${LOG}
> "${FLAVOR}" ${FLAGS} ${FILES} >> ${LOG} 2>&1
> if egrep -s -e "While compiling|\*\*" ${LOG} ;
> then
>   echo "There was an error. See ${LOG} for details"
>   exit 1
> else
>   echo "No errors doing whatever"
> fi

The warnings aren't fatal.  I just prefer to display them.

Thanks!



Reply to: