$ dash -c '{ exec 8</dev/null; } 8<&-; : <&8 && echo "oops, still open"'
Output: "oops, still open"
Expected output: Bad file descriptor
Apparently, dash either fails to push the file descriptor onto the stack
at '} 8<&-', or fails to restore it.
Same bug with loops ending in "done 8<&-".
Confirmed in all dash versions down to 0.5.5.1.
Also note that pushing an open file descriptor works as expected:
$ dash -c '{ exec 8</dev/null; } 8</dev/tty; : <&8 && echo "oops, still
open"'
Output: Bad file descriptor (as expected)
FYI:
* bash and dash have this bug;
* zsh, yash, AT&T ksh93, pdksh, mksh, posh, schily's bosh, Busybox ash,
FreeBSD sh, and NetBSD sh all do this correctly.
Thanks,
- Martijn
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html