Skip to content

mc-wrapper.sh: Can't change to directory ending in \n #4884

@egmontkob

Description

@egmontkob

Is there an existing issue for this?

  • I have searched the existing issues

Midnight Commander version and build configuration

4.8.33, git

Operating system

.

Is this issue reproducible using the latest version of Midnight Commander?

  • I confirm the issue is still reproducible with the latest version of Midnight Commander

How to reproduce

source mc.sh to set up using mc-wrapper.sh. This way, when quitting mc, the shell changes to that directory.

Go to a directory whose name ends in a newline. Quit mc. The shell doesn't change there.

Related to #2325 / pending PR #4804. Command substituion, used for reading the file's contents, strips off all trailing newlines.

A solution could be for the emitter to emit an additional letter, and then to strip it off using shell string operations:

MC_PWD="`cat "$MC_PWD_FILE"; echo _`"
MC_PWD="${MC_PWD%_}"

Expected behavior

.

Actual behavior

.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions