Ticket #4066 (new defect)

Opened 7 months ago

Mess in shell history

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

Description

Mc fills shell history with garbage shell commands unless I set HISTCONTROL to "ignoreboth" (or "ignorespace")

Steps to reproduce:

  1. add "HISTCONTROL=ignoreboth" to your "~/.bashrc"
  2. restart your machine
  3. open a new terminal
  4. run "HISTCONTROL=ignoredups"
  5. run "mc"
  6. change to any directory
  7. press F10 to exit
  8. open a new terminal
  9. run "history"

You will probably see something like this:

 7106  2020-02-25 18:06:50  PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND }'pwd>&10;kill -STOP $$'
 7107  2020-02-25 18:07:01  cd "`printf '%b' '\0057home\0057curusarn\0057git'`"
 7108  2020-02-25 18:06:50 mc

I have found a recommendation in the FAQ to set HISTCONTROL to "ignoreboth" in my profile file:

6.8 I see lot of strange 'cd "printf ' lines into my .history file
Add export HISTCONTROL="ignoreboth" into your ~/.profile file (.bash_profile) for avoid this.

I did add "HISTCONTROL=ignoreboth" to the end of my "~/.bash_profile" and restarted my machine but running mc still outputs mess into my shell history. The issue only disappears when I add "HISTCONTROL=ignoreboth" to "~/.bashrc".

The problem is that I want to have commands with leading space in my shell history but I don't want to have some mess from mc in my shell history.

Is there any way I can use mc without it outputting garbage into my shell history? Why do you rely on "ignorespace" in the first place? Couldn't you for example turn off the history before running these commands (via "set +o history")?

$ mc -V
GNU Midnight Commander 4.8.24
Built with GLib 2.62.4
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish, smbfs
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
$ LC_MESSAGES=C mc -F
Home directory: /home/curusarn
Profile root directory: /home/curusarn

[System data]
    Config directory: /etc/mc/
    Data directory:   /usr/share/mc/
    File extension handlers: /usr/lib/mc/ext.d/
    VFS plugins and scripts: /usr/lib/mc/
	extfs.d:        /usr/lib/mc/extfs.d/
	fish:           /usr/lib/mc/fish/

[User data]
    Config directory: /home/curusarn/.config/mc/
    Data directory:   /home/curusarn/.local/share/mc/
	skins:          /home/curusarn/.local/share/mc/skins/
	extfs.d:        /home/curusarn/.local/share/mc/extfs.d/
	fish:           /home/curusarn/.local/share/mc/fish/
	mcedit macros:  /home/curusarn/.local/share/mc/mc.macros
	mcedit external macros: /home/curusarn/.local/share/mc/mcedit/macros.d/macro.*
    Cache directory:  /home/curusarn/.cache/mc/
Note: See TracTickets for help on using tickets.