Source-Changes-D archive

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

Re: CVS commit: src/tests/util/sh



On Thu, Jun 03, 2010 at 06:53:36PM +0000, Christos Zoulas wrote:
 > >>   # according to the standard, only failing *simple* commands
 > >>   # cause an exit under -e. () is not a simple command.
 > >> - dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK'
 > >> - echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK'
 > >> + dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK'
 > >> + echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK'
 > >
 > >The comment explains that failure of the inner subshell should not cause
 > >the outer subshell to exit.  This means that both the inner and outer
 > >"echo OK" should be performed; but the test expects only the inner "echo
 > >OK" to be performed.  Similarly for the other changed tests.
 > 
 > Well, I was not sure what to do there [fix the comments, or remove the
 > tests]. Bash and ksh behave the same way as ours does, so I am inclined
 > to believe that the standard is mis-worded or mis-interpreted.

There have been at least two different lengthy arguments about this
recently. Checking the comment logs for the PRs referenced in the test
script will find at least one of those; there was another on
tech-userlevel about two years ago. There have been only two
undisputed conclusions from those arguments, namely:

   (1) the standard is vague and in some cases definitely wrong;
   (2) the issue is so finicky/nitpicky that it's nearly impossible to
       write mailing-list posts about it that do not contain errors,
       including posts that attempt to correct errors in prior posts.

I have been contemplating trying to work up a formal semantics for
this because I don't see any other hope of ever getting it to behave
sanely or consistently.

However, whitewashing the tests in the meantime isn't particularly
helpful. The tests are failing because there are open PRs and sh is
broken.

If it's more important that the nightly test runs come up clean than
that it actually check for correct behavior so sh gets fixed, the test
script should at least document what the correct behavior is. I have
done this much, although I'm inclined to think the changes should be
reverted entirely.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index