Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 891294 Details for
Bug 930401
app-misc/mc: In subshell mode, it is not understood that PROMPT_COMMAND may be an array
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
mc-4.8.31-clear-PROMPT_COMMAND.patch
mc-4.8.31-clear-PROMPT_COMMAND.patch (text/plain), 3.14 KB, created by
kfm
on 2024-04-22 00:53:46 UTC
(
hide
)
Description:
mc-4.8.31-clear-PROMPT_COMMAND.patch
Filename:
MIME Type:
Creator:
kfm
Created:
2024-04-22 00:53:46 UTC
Size:
3.14 KB
patch
obsolete
>From 833da535e3d4fe0144241ae624a703f23885fa77 Mon Sep 17 00:00:00 2001 >From: Kerin Millar <kfm@plushkava.net> >Date: Mon, 22 Apr 2024 01:33:51 +0100 >Subject: [PATCH] src/subshell/common.c: clear PROMPT_COMMAND in the course of > adjusting it > >Unless mc is launched with the superlatively misnamed -u or --nosubshell >options, it will launch its embedded shell as an interactive instance. >Further, in the case that the shell is bash, mc will convey a fairly >complicated sequence of commands to initialise the shell, one of which >is as follows. > >PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND\n}'pwd>&%d;kill -STOP $$' > >There, %d is replaced by g_snprintf() with the file descriptor of a pipe >from which mc reads. This is rather clumsy. Moroever, it is incorrect >because it is possible for PROMPT_COMMAND to be an array, as is >supported since the release of Bash 5.1. In that case, mc will adjust >the first element of the array, which is clearly not the intent. > >As far as Gentoo is concerned, matters are complicated by the fact that: > >- Gentoo's system-wide bashrc defines PROMPT_COMMAND as an array >- Gentoo's PROMPT_COMMAND alters window and/or pane titles by default >- Midnight Commander performs its own, opinionated, title manipulation > >One possibility would be to have Gentoo refrain from populating >PROMPT_COMMAND in the event that bash is running as a subprocess of mc. >The prospect of Gentoo developing a collection of application-specific >hacks in bashrc context seems unappealing, however. > >Instead, let's patch mc to clear PROMPT_COMMAND in the course of >defining it. One disavantage in doing it this way is that PROMPT_COMMAND >customisations applied by ~/.bashrc will be disregarded. Still, try as I >might, I could not think of a plausible scenario in which this would >negatively impact upon the use of mc. > >This patch is not intended to be upstreamable. The Midnight Commander >developers would probably prefer a patch that renders it array-aware, so >that it can append its command, if necessary. For Gentoo, it seems >simpler just to let mc do as it wishes and not stand in its way, so to >speak. > >It should be noted that defining PROMPT_COMMAND as an array containing a >single element is safe, even for versions of bash older than 5.1. > >Signed-off-by: Kerin Millar <kfm@plushkava.net> >Bug: https://bugs.gentoo.org/930401 >--- > src/subshell/common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/src/subshell/common.c b/src/subshell/common.c >index 4827da044..3d6a81bef 100644 >--- a/src/subshell/common.c >+++ b/src/subshell/common.c >@@ -1090,7 +1090,7 @@ init_subshell_precmd (char *precmd, size_t buff_size) > " bind -x '\"\\e" SHELL_BUFFER_KEYBINDING "\":\"mc_print_command_buffer\"'\n" > " bind -x '\"\\e" SHELL_CURSOR_KEYBINDING > "\":\"echo $BASH_VERSINFO:$READLINE_POINT >&%d\"'\n" >- " PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND\n}'pwd>&%d;kill -STOP $$'\n" >+ " PROMPT_COMMAND=('pwd>&%d;kill -STOP $$')\n" > "PS1='\\u@\\h:\\w\\$ '\n", command_buffer_pipe[WRITE], > command_buffer_pipe[WRITE], subshell_pipe[WRITE]); > break; >-- >2.44.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 930401
: 891294