Version in base suite: 4.8.33-1 Base version: mc_4.8.33-1 Target version: mc_4.8.33-1+deb13u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/m/mc/mc_4.8.33-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/m/mc/mc_4.8.33-1+deb13u1.dsc changelog | 7 +++ patches/series | 1 patches/subshell-fd.patch | 90 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) diff -Nru mc-4.8.33/debian/changelog mc-4.8.33/debian/changelog --- mc-4.8.33/debian/changelog 2025-01-29 06:43:17.000000000 +0000 +++ mc-4.8.33/debian/changelog 2025-08-26 16:08:19.000000000 +0000 @@ -1,3 +1,10 @@ +mc (3:4.8.33-1+deb13u1) trixie; urgency=high + + * Non-maintainer upload. + * Added debian/patches/subshell-fd.patch (Closes: #1108061) + + -- Thorsten Glaser Tue, 26 Aug 2025 16:08:19 +0000 + mc (3:4.8.33-1) unstable; urgency=medium * New upstream release. diff -Nru mc-4.8.33/debian/patches/series mc-4.8.33/debian/patches/series --- mc-4.8.33/debian/patches/series 2024-05-02 10:56:45.000000000 +0000 +++ mc-4.8.33/debian/patches/series 2025-08-26 16:04:06.000000000 +0000 @@ -1,5 +1,6 @@ ## UPSTREAM / FORWARDED: 2987.patch +subshell-fd.patch ## DEBIAN FIXES AND ENHANCEMENTS: dummy-zip-password.patch diff -Nru mc-4.8.33/debian/patches/subshell-fd.patch mc-4.8.33/debian/patches/subshell-fd.patch --- mc-4.8.33/debian/patches/subshell-fd.patch 1970-01-01 00:00:00.000000000 +0000 +++ mc-4.8.33/debian/patches/subshell-fd.patch 2025-08-26 16:04:06.000000000 +0000 @@ -0,0 +1,90 @@ +Description: fix accidental use of >&10 for subshells + POSIX requires shells to only support fd numbers of up to 9 + for I/O redirections but mc inserts PS1 with “pwd>&%d”, where + %d is subshell_pipe[WRITE] which can be a number ≥ 10 which + can cause a number of failures in shells that don’t extend + beyond POSIX: an error seen when stracing; a ten-second delay + at startup; “Pause after run” ignored… + . + This patch moves the pipe(2) call to slightly earlier so the + chance to get a low enough fd is better. +Bug: https://github.com/MidnightCommander/mc/issues/4634 +Forwarded: https://github.com/MidnightCommander/mc/pull/4724 +Author: Thorsten Glaser + +--- a/src/subshell/common.c ++++ b/src/subshell/common.c +@@ -1537,36 +1537,6 @@ init_subshell (void) + if (mc_global.shell->type == SHELL_NONE) + return; + +- /* Open a pty for talking to the subshell */ +- +- /* FIXME: We may need to open a fresh pty each time on SVR4 */ +- +-#ifdef HAVE_OPENPTY +- if (openpty (&mc_global.tty.subshell_pty, &subshell_pty_slave, NULL, NULL, NULL)) +- { +- fprintf (stderr, "Cannot open master and slave sides of pty: %s\n", +- unix_error_string (errno)); +- mc_global.tty.use_subshell = FALSE; +- return; +- } +-#else +- mc_global.tty.subshell_pty = pty_open_master (pty_name); +- if (mc_global.tty.subshell_pty == -1) +- { +- fprintf (stderr, "Cannot open master side of pty: %s\r\n", unix_error_string (errno)); +- mc_global.tty.use_subshell = FALSE; +- return; +- } +- subshell_pty_slave = pty_open_slave (pty_name); +- if (subshell_pty_slave == -1) +- { +- fprintf (stderr, "Cannot open slave side of pty %s: %s\r\n", +- pty_name, unix_error_string (errno)); +- mc_global.tty.use_subshell = FALSE; +- return; +- } +-#endif /* HAVE_OPENPTY */ +- + /* Create a pipe for receiving the subshell's CWD */ + + if (mc_global.shell->type == SHELL_TCSH) +@@ -1608,6 +1578,36 @@ init_subshell (void) + mc_global.tty.use_subshell = FALSE; + return; + } ++ ++ /* Open a pty for talking to the subshell */ ++ ++ /* FIXME: We may need to open a fresh pty each time on SVR4 */ ++ ++#ifdef HAVE_OPENPTY ++ if (openpty (&mc_global.tty.subshell_pty, &subshell_pty_slave, NULL, NULL, NULL)) ++ { ++ fprintf (stderr, "Cannot open master and slave sides of pty: %s\n", ++ unix_error_string (errno)); ++ mc_global.tty.use_subshell = FALSE; ++ return; ++ } ++#else ++ mc_global.tty.subshell_pty = pty_open_master (pty_name); ++ if (mc_global.tty.subshell_pty == -1) ++ { ++ fprintf (stderr, "Cannot open master side of pty: %s\r\n", unix_error_string (errno)); ++ mc_global.tty.use_subshell = FALSE; ++ return; ++ } ++ subshell_pty_slave = pty_open_slave (pty_name); ++ if (subshell_pty_slave == -1) ++ { ++ fprintf (stderr, "Cannot open slave side of pty %s: %s\r\n", ++ pty_name, unix_error_string (errno)); ++ mc_global.tty.use_subshell = FALSE; ++ return; ++ } ++#endif /* HAVE_OPENPTY */ + } + + /* Fork the subshell */