Paul Eggert <address@hidden> wrote:
> Here's a proposed patch that's been lurking in my archives for a
> while. I audited all the use of exit statuses in coreutils, and found
> some problems. The worst example:
>
> $ mkdir d d/e d/e/f
> $ chmod a-w d
> $ rmdir -p d d/e/f
> rmdir: `d': Directory not empty
> rmdir: `d/e': Permission denied
> $ echo $?
> 0
>
> The exit status should be 1, not 0.
>
> I also noticed that EXIT_FAILURE might not equal 1, as POSIX does not
> require it. I recall that it's not 1 on traditional VMS, though I
> don't know if anyone uses coreutils on VMS or OpenVMS or whatever it's
> called these days. The patch below also addresses this issue, by
> adjusting the documentation slightly and introducing a new symbol
> EXIT_FAIL for when programs want to return 1 even if EXIT_FAILURE
> isn't 1.
Wow. That was a big one.
I've applied it and added a test for the rmdir bug.
Thank you!