[sr #107449] selftest sh-script fails on non-bash

anonymous INVALID.NOREPLY at gnu.org
Fri Aug 6 22:49:33 CEST 2010


URL:
  <http://savannah.gnu.org/support/?107449>

                 Summary: selftest sh-script fails on non-bash
                 Project: GnuTLS
            Submitted by: None
            Submitted on: Fri 06 Aug 2010 08:49:33 PM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 2 - Minor
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: m.drochner at fz-juelich.de
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: *BSD

    _______________________________________________________

Details:

tests/openpgp-certs/testselfsigs sets "set -e" but later does:
unset RETCODE

This happens to work with bash because "unset" doesn't give an error
there if the variable wasn't defined before.
A regular/Posix sh gives a non-zero return code here, stopping the
script in its tracks due to the "-e".
See http://www.opengroup.org/onlinepubs/000095399/utilities/unset.html
for reference. The wording is somewhat poor because it says
"Unsetting a variable or function that was not previously set shall
not be considered an error and does not cause the shell to abort".
It is not about aborting in the common case but about the exit code;
the aborting would only due to the "-e".
Anyway, the sh and ksh implementations I found give a non-zero
return code in this situation.

Replacing the offending line with
unset RETCODE || true
fixes the issue.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?107449>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





More information about the Gnutls-devel mailing list