Tiny Core Linux

Tiny Core Extensions => TCE Bugs => Topic started by: Misalf on February 01, 2017, 06:30:24 PM

Title: piCore 8.x - .ash_history spammed by Midnight Commander
Post by: Misalf on February 01, 2017, 06:30:24 PM
Using Midnight Commander on piCore 8.x creates lots of quite useless entries like the following in  .ash_history .
Code: [Select]
precmd() { if [ ! "${PWD##$HOME}" ]; then MC_PWD="~"; else [ "${PWD##$HOME/}" = "$PWD" ] && MC_PWD="$PWD" || MC_PWD="~/${PWD##$HOME/}"; fi; echo "$USER@$(hostname -s):$MC_PWD"; pwd>&6; kill -STOP $$; }; PRECMD=precmd; PS1='$($PRECMD)$ '
Does anyone know how to prevent / fix this?

BTW, .bash_history is not affected.
Title: Re: piCore 8.x - .ash_history spammed by Midnight Commander
Post by: bmarkus on February 03, 2017, 07:28:26 AM
I can't reproduce, both tc and root history is clean on my development system and on a new installation. Please delete your history, make a backup and watch for it. If appears again, try to identify steps caused it.

Thanks!
Title: Re: piCore 8.x - .ash_history spammed by Midnight Commander
Post by: patrikg on February 03, 2017, 08:46:59 AM
Could MC add these when you pressing <CTRL><O>.
To switch between the MC and Shell.
Title: Re: piCore 8.x - .ash_history spammed by Midnight Commander
Post by: Rich on September 28, 2024, 01:40:27 AM
Hi Misalf
I've just set up TC15 x86_64 and Midnight Commander
is spamming my  .ash_history  file too.

I came up with a couple of fixes.

Adding this to  .profile  fixes mc when started from the command line:
Code: [Select]
# Stop Midnight Commander from spamming the command history files.
alias mc='env HISTFILE=/dev/null mc'

A file placed in .X.d containing this fixes mc when started from the pop up menu:
Code: [Select]
# Fix the desktops popup menu.
[ -f ~/.wmx/Applications/mc ] && echo -e "#!/bin/sh\nenv HISTFILE=/dev/null xterm -e mc" > ~/.wmx/Applications/mc

Adding these lines to that file fixes the wbar icon:
Code: [Select]
# Fix the wbar icon.
DESKTOP="/usr/local/share/applications/mc.desktop"

# Replace the link with a file so we can edit it.
[ -L "$DESKTOP" ] && sudo busybox cp "$(readlink "$DESKTOP")" "$DESKTOP"
[ -f "$DESKTOP" ] && sudo sed -i 's|^Exec=.*|Exec=~/.wmx/Applications/mc|' "$DESKTOP"
[ -f "$DESKTOP" ] && wbar_rm_icon mc
[ -f "$DESKTOP" ] && wbar_update.sh mc

I've attached a copy of the file I placed in .X.d in case
anyone else runs into this problem.

These commands get run automatically when X starts.
If you install mc after X starts, you can run the file like this:
Code: [Select]
chmod 775 .X.d/FixMC
./.X.d/FixMC
Restart any running instances of mc and the spamming will stop.