Ticket #3090 (new defect)

Opened 10 years ago

Prompt not updated, shows wrong directory

Reported by: egmont Owned by:
Priority: major Milestone: Future Releases
Component: mc-core Version: 4.8.10
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

Have two directories /tmp/A and /tmp/B, the first one containing an archive, e.g. /tmp/A/foobar.tar.xz. Have a shell prompt that shows the current directory.

Make mc show /tmp/A in the left panel, /tmp/B in the right. As you Tab between them, the prompt gets updated correctly.

Enter the archive, the prompt still contains /tmp/A. Press Tab, the prompt is updated to /tmp/B. Press Tab again, the cursor goes back to the archive, but the prompt still says /tmp/B. This is kind of irrelevant because you cannot execute external comments from an archive... as long as you have the panels off. But press Ctrl+O and problems arise.

Case 1: Start "mc /tmp/A /tmp/B" with a config option that the left panel is active initially. Enter the archive. Press Ctrl+O. You're left without a prompt, but you can still type a command and execute that.

Case 2: Start "mc /tmp/A /tmp/B" again. Press Ctrl+O twice. Enter the archive. Press Tab twice. Press Ctrl+O. You see the prompt containing /tmp/A as the current directory, but the command will be executed in /tmp/B. This is very misleading, and may cause the user to execute a harmful command (e.g. removal of a file that actually removes a different file).

(My suggestion on how to change the behavior: Upon entering a virtual directory or pressing Tab to move the cursor to such a panel, the subshell's cwd should be updated to the local path of the directory containing the archive (/tmp/A in this example), or to the user's home if it's a remote (e.g. ftp) listing. This would also help addressing ticket #3088 and have a consistent nice behavior.)

Note: See TracTickets for help on using tickets.