Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930401 - app-misc/mc: In subshell mode, it is not understood that PROMPT_COMMAND may be an array
Summary: app-misc/mc: In subshell mode, it is not understood that PROMPT_COMMAND may b...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Viorel Munteanu
URL: https://midnight-commander.org/ticket...
Whiteboard:
Keywords: PATCH, UPSTREAM
Depends on:
Blocks:
 
Reported: 2024-04-22 00:52 UTC by kfm
Modified: 2025-01-23 15:50 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mc-4.8.31-clear-PROMPT_COMMAND.patch (mc-4.8.31-clear-PROMPT_COMMAND.patch,3.14 KB, patch)
2024-04-22 00:53 UTC, kfm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kfm 2024-04-22 00:52:07 UTC
Presently, Midnight Commander initialises interactive instances of bash in such a way that it fails to acknowledge that it is possible for PROMPT_COMMAND to be an array, as is supported since bash 5.1. This is material to Gentoo because >=bash-5.1_p16-r8 and >=bash-5.2-p26-r1 do initialise the variable as an array. Besides which, anyone might do the same in their own ~/.bashrc file.

I shall attach a patch that I think is suitable for Gentoo, whose commit message will contain a detailed rationale.
Comment 1 kfm 2024-04-22 00:53:46 UTC
Created attachment 891294 [details, diff]
mc-4.8.31-clear-PROMPT_COMMAND.patch
Comment 2 kfm 2024-04-22 01:06:04 UTC
To comment further, upstream ought to be doing something like this:

if eval '[[ ${PROMPT_COMMAND@a} == *a* ]]' 2>/dev/null; then
	PROMPT_COMMAND+=('mc crap goes here')
else
	PROMPT_COMMAND+=';mc crap goes here'
fi

I maintain that the attached patch is likely the better solution for Gentoo, however.
Comment 3 kfm 2024-04-22 01:16:37 UTC
There are times at which I wish I could edit comments. Rather, upstream could fix it from their perspective by doing something like:

if eval '[[ ${PROMPT_COMMAND@a} == *a* ]]' 2>/dev/null; then
	PROMPT_COMMAND+=('mc crap goes here')
else
	PROMPT_COMMAND+=${PROMPT_COMMAND+$PROMPT_COMMAND$'\n'}'mc crap goes here'
fi
Comment 4 Larry the Git Cow gentoo-dev 2025-01-23 15:50:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d2dfa65ffe23e2ded46450a7249c5a3034b8c24

commit 3d2dfa65ffe23e2ded46450a7249c5a3034b8c24
Author:     Viorel Munteanu <ceamac@gentoo.org>
AuthorDate: 2025-01-23 12:40:12 +0000
Commit:     Viorel Munteanu <ceamac@gentoo.org>
CommitDate: 2025-01-23 15:50:24 +0000

    app-misc/mc: add 4.8.33
    
    Closes: https://bugs.gentoo.org/930401
    Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>

 app-misc/mc/Manifest         |   1 +
 app-misc/mc/mc-4.8.33.ebuild | 139 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)