tech-userlevel archive

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

Re: sh -e changes broke pkgsrc



 >> As I suspected it was a case of broken shell code in "pkgsrc". It used
 >> this construct with "set -e":
 >> 
 >>     while read type pattern dir; do                                 \
 >>             ${TEST} "$$type" != "bootstrap" && continue;            \
 >>             ${_DEPENDS_INSTALL_CMD};                                \
 >>     done
 >> 
 >> If "$$type" is "bootstrap" the whole ".. && ..." expression will evaluate
 >> to false and the shell should terminate evaluation. 

> According to POSIX only failing *simple commands* are supposed to
> cause -e exits. So this is not true...

Strictly speaking you right.  Though, this is nonsense IMHO.

  false && false
  false && true
  true  && false

does NOT exit with NetBSD's /bin/ksh, pdksh, mksh,
bash and heirloom sh. Linux's dash works differently
  'false && false' - does NOT exit
  'false && true'  - does NOT exit
  'true && false'  - exits

At the same time

  false || false

DOES exit in all these shells (including NetBSD /bin/sh).





P.S.
Is there other online specification of the shell?

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index