tests: avoid spurious failure of 't/uninstall-fail.sh' on OpenIndiana
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 4 Aug 2012 18:06:28 +0000 (20:06 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 4 Aug 2012 18:06:28 +0000 (20:06 +0200)
commit3632e7d87d2deba49abdf1dba9fbb536ce58328d
tree5d602653e6c404c0ee07f803770006adc05e35a3
parent96afe638f09cd5fc32659883952b89f2d7e2a315
tests: avoid spurious failure of 't/uninstall-fail.sh' on OpenIndiana

On current OpenIndiana (based on what once was OpenSolaris 11), the shell
/bin/sh (which, differently from what happens on Solaris, is a true POSIX
shell, thus worthy of consideration) somehow manages to "eat" the
error message from 'rm' when that fails to remove a file due to lacking
permission on the parent directory:

  $ /bin/sh -c "cd unwritable-dir || { echo OOPS; exit 1; }; rm -f foo"
  $ echo rc = $?
  rc = 1
  $ /bin/bash -c "cd unwritable-dir || { echo OOPS; exit 1; }; rm -f foo"
  rm: foo not removed: Permission denied
  $ echo rc = $?
  rc = 2
  $ /bin/sh -c "cd unwritable-dir || { echo OOPS; exit 1; }; env rm -f foo"
  rm: foo not removed: Permission denied
  $ echo rc = $?
  rc = 2

That is probably due to an improper optimization, that is, the shell tries
to be smart and remove the file itself instead of invoking 'rm', but fails
spectacularly in the attempt.

* t/uninstall-fail.sh: The just-described bug was causing a spurious
failure in this test case.  Cater to thus situation, by relaxing the
test when a faulty shell is detected.  And while at it, fix and improve
an unrelated comment.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/uninstall-fail.sh