1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tests/io.sh: add proc subst FD leak test (re: ab5dedde)

This commit is contained in:
Martijn Dekker 2020-09-14 09:27:41 +02:00
parent d7c90eadc3
commit f0be4d95e8

View file

@ -618,5 +618,19 @@ fi
(exec 7>bad.txt; "$SHELL" -c 'print bad >&7' 2>/dev/null)
[[ $(<bad.txt) == '' ]] || err_exit 'File descriptors > 2 inherited without POSIX mode' "(got $actual)"
# ======
# File descriptor leak with process substitution
err=$(
ulimit -n 15 || exit 0
fdUser() {
:
}
set +x
for ((i=1; i<10; i++))
do fdUser <(:) >(:) || exit
done 2>&1
) || err_exit 'Process substitution leaks file descriptors when used as argument to function' \
"(got $(printf %q "$err"))"
# ======
exit $((Errors<125?Errors:125))