Skip to content

Clean up subshell precmd and PS1 handling #4634

@mc-butler

Description

@mc-butler

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/4634
Reporter zaytsev (@zyv)
Mentions ossi (@ossilator), d3m3t3r (d3m3t3r@….com)

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.


add /bin/lksh as well, it’s present on many systems (all Debian derivatives, plus others) and is an mksh binary built with POSIX semantics where they cannot be made a run-time option (such as width of the arithmetic data type)

Originally posted by @mirabilos in 9f5d80d

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues not related to a specific subsystemprio: mediumHas the potential to affect progress

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions