Ticket #4634 (new enhancement)
Clean up subshell precmd and PS1 handling
Reported by: | zaytsev | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.8.34 |
Component: | mc-core | Version: | master |
Keywords: | Cc: | ossi, d3m3t3r | |
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
Follow-up for #3748:
We want to remove our PS1 / prompt fallbacks for all shells and cleanup fallback precmd handling:
"_mc_precmd() { " " pwd>&%d; " " kill -STOP $$; " "}; " "_MC_PRECMD=_mc_precmd; " "PS1='$($_MC_PRECMD)'\"${PS1:-'$PWD $ '}\"\n";
to actually answer the question whether PS1 can be unset in the first place: probably not. i mean, it can if you manually unset it, but dash actually shows no prompt at all in this case. so arguably, providing even a minimal PS1 fallback is unnecessary.
It's definitely quite unlikely an interactive shell not setting PS1. The user would need to mess up something. IMO, the default PS1 could be removed from every 'precmd' code if we check all shells cope with empty PS1 reasonably. For bash, you can test it by adding "unset PS1" into .bashrc. It seems to work fine.
Change History
comment:2 Changed 15 hours ago by d3m3t3r
Note the PS1 fallback is still present in the proposed code, only now it is '$PWD $ '.
IMHO, this ticket would make the code look a bit simpler and cleaner but many users, e.g. with busybox/ash/dash, will just loose a feature - $HOME prefix in $PWD no longer replaced by '~'. May not be worth it.
This PR is about *fixing* the existing PS1 fallback, not removing it.
PR: https://github.com/MidnightCommander/mc/pull/212