The Original ATT Korn Shell
Go to file
Vincent Mihalkovic 05db1c3657 Fix /dev/fd script redirection failure with iomovefd fd range
The original backport of upstream commit aa75399b (RHEL-146564) changed
sh_iomovefd(fd) to sh_iomovefd(fd,10), pushing script-open fds into the
>=10 internal range. On c8s, sh_iomovefd uses recursive dup() rather than
fcntl(F_DUPFD, minfd). dup() always returns the lowest available fd, so
reaching >=10 requires a chain of hops (3->4->5->...->10), each sensitive
to the fd table state at that moment. If another part of ksh opens or
closes an fd between hops, the chain lands somewhere unexpected. Upstream
avoids this with fcntl(F_DUPFD, 10), which jumps directly in one syscall.
This caused fd collisions with the 3-9 user-redirect range tracked by
shp->inuse_bits, resulting in "redirection failed [Bad file descriptor]"
under complex shell environments (set -x + PS4 command substitution +
module load).

Revert the minfd argument from 10 to 3 in path.c (path_opentype, exscript)
and main.c (fdin), restoring the original fd placement behavior while
preserving the /dev/fd $0 fix from RHEL-146564.

Resolves: RHEL-188169
2026-08-12 10:40:54 +02:00
.fmf tests: add tmt gating test plans 2025-04-08 17:16:51 +02:00
plans tests: add tmt gating test plans 2025-04-08 17:16:51 +02:00
.gitignore re-import sources as agreed with the maintainer 2023-07-10 14:23:45 +02:00
ci.fmf tests: add tmt gating test plans 2025-04-08 17:16:51 +02:00
dotkshrc Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
expectedresults.log Import rpm: c8s 2023-02-27 13:51:52 -05:00
gating.yaml tests: add tmt gating test plans 2025-04-08 17:16:51 +02:00
ksh-1.0.7-history-trim.patch Resolves: RHEL-5685 - Fix crash on failure to trim ~/.sh_history 2024-01-04 11:01:24 +01:00
ksh-1.0.11-devfd-memory-fault.patch Fix /dev/fd script redirection failure with iomovefd fd range 2026-08-12 10:40:54 +02:00
ksh-1.0.11-ssh-multibyte-long-paste.patch Further fix long multibyte characters paste issue via ssh 2025-06-25 15:47:56 +02:00
ksh-1.0.12-security.patch Fix arbitrary command execution/code injection bugs 2025-07-22 09:21:44 +02:00
ksh-20070328-builtins.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20080202-manfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20100202-pathvar.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20100621-fdstatus.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20100621-manfix3.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20100826-fixregr.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-alarmifs.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-annocheck.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-argvfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-assoc-unset-leak.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-badgcc.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-ccflags.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-cdfix2.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-cdfix3.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-cdfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-cdfork.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-covsfix2.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-covsfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-crash.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-cve-2019-14868.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-dotdoublefree.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-emptyarrayinit.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-F_dupfd_cloexec.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-fd2lost.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-filecomsubst.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-forkbomb.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-fununset.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-glibc-build-fix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-heresub.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-iso8859.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-jobcontrol.patch Auto sync2gitlab import of ksh-20120801-255.el8.src.rpm 2022-06-06 22:03:51 -04:00
ksh-20120801-jobwait-sigstop.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-kia.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-kshmfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-lexfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-locking.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-macro.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-mb-after-argvar.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-memlik3.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-memlik.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-mlikfiks.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-mtty.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-noexeccdfix.patch re-import sources as agreed with the maintainer 2023-07-10 14:23:45 +02:00
ksh-20120801-nohupfork.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-nomulti.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-nv_open-memcmp.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-oldenvinit.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-parserfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-posix-exit.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-retfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-rmdirfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-roundit.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-segfault-cd-paths.patch fix segfault in subshell if $PATH contains a .paths directory 2023-11-08 17:00:51 +01:00
ksh-20120801-segfault-long-command.patch Resolves: #2013909 - Fix crash on trying a very long command 2023-08-25 14:00:08 +02:00
ksh-20120801-segfault-strdup.patch Re-fix segfault in strdup 2024-02-09 23:49:53 +01:00
ksh-20120801-set+r-fix.patch Fix set +r so that it cannot unset the restricted option 2023-09-18 12:49:48 +02:00
ksh-20120801-sh_iovalidfd.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-signal-bubbling.patch Auto sync2gitlab import of ksh-20120801-256.el8.src.rpm 2022-08-02 08:12:41 +00:00
ksh-20120801-stack-robustness-2.patch Auto sync2gitlab import of ksh-20120801-257.el8.src.rpm 2022-08-28 16:14:47 +00:00
ksh-20120801-stack-robustness.patch Auto sync2gitlab import of ksh-20120801-257.el8.src.rpm 2022-08-28 16:14:47 +00:00
ksh-20120801-subshell-interrupt-segv.patch fix crashes when interrupting subshells 2024-01-26 15:25:04 +01:00
ksh-20120801-subshell-jobwait.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-subshell-leak.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-sufix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-syntax-error.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-tabfix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-tpstl.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-trapcom.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-typeset.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-unset-param.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-validate-fd.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20120801-xtrace-utf8-quoting.patch fix UTF-8 quoting in xtrace 2023-11-09 13:25:20 +01:00
ksh-20120801-xufix.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20130214-fixkill.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20130613-cdfix4.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20130628-longer.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20140301-fikspand.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20140415-hokaido.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20140801-arraylen.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20140801-diskfull.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh-20140929-safefd.patch Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
ksh.spec Fix /dev/fd script redirection failure with iomovefd fd range 2026-08-12 10:40:54 +02:00
kshcomp.conf Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
kshrc.rhs Auto sync2gitlab import of ksh-20120801-254.el8.src.rpm 2022-05-26 10:05:36 -04:00
sources re-import sources as agreed with the maintainer 2023-07-10 14:23:45 +02:00