-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subshell precmd emulation fills ash/dash/csh/tcsh history with internal pwd commands #2104
Comments
IMHO this bug is by-effect of #213 |
Replying to angel_il:
It is not only a side-effect of #213 but enables you to all sorts of bad things.
example:
run mc |
Replying to adminX:
Yikes, indeed... :/ Well, this one really sucks. |
After getting some sleep and another look at the patch the bug report itself is not a side-effect of #213. #213 only enables you to accidentally execute unexpected commands. The execution of the commands mentioned in the bug report are needed to change the subshell to the correct directory.
I think it is impossible to remove them and keep the subshell and current panel directories in sync without feeding some sort of command to the subshell. |
Hello... I probably was not clear enough. This is NOT about cd only... E.g. pwd does the same thing. Worse yet, it is NOT needed to type cd or any other command manually, simply switching to another dir on the second pane, using (or merely switching to) a subshell there, going back tu first pane and using subshell there spams bash history with tons of junk. E.g., have /usr in first panel, /tmp in second and do the above, you'll get:
echo
I don't know whether you realize the severity of the problem, because it currently makes my bash history practically unusable.
$ grep printf ~/.bash_history | wc -l
And there's another thing:
$ grep PROMPT_COMMAND .bash_history | wc -l
but that's probably #2027 more than this. |
Logging of Midnight Commander's cd and PROMPT_COMMAND lines happens if $HISTCONTROL is unset or otherwise not set to ignorespace or ignoreboth.
#2027 has the problem in the other direction as MC overwrites the variable after starting bash. |
Hmmm... I don't think this is the case.
$ echo $HISTCONTROL
on all boxes where I experience this issue. So, HISTCONTROL won't help here. Meanwhile, export HISTIGNORE='cd "\`printf*' will work around logging most of the noise but that's obviously not a real solution. |
Replying to doktornotor:
this is wrong. the separator is a colon. |
Oh well, a lot if misunderstanding here apparently. So - the above is what bash spits out as ENV variable, so wrt separators you need to talk to bash upstream.
$ grep HISTCONTROL $HOME/.bashrc |
$HISTCONTROL is evaluated every time a command is executed.
Your export HISTCONTROL="ignoreboth" in ~/.bashrc seems to be overridden by a sourced script. |
Well... indeed, figured out. This all junk was caused by sourcing a stale mc.sh wrapper in .bashrc which in turn sourced another stale mc-wrapper.sh which attempted to append stuff to $HISTCONTROL in a broken way. From where did those stale files come - no idea *g*
So, thanks for help and close this, and sorry for wasting your time. |
Added answer into FAQ:
http://www.midnight-commander.org/wiki/doc/faq#a6.8Iseelotofstrangecdprintflinesintomy.historyfile
If answer in FAQ not clean - keep comments here. |
Pretty clean and clear to me... Hopefully this saves other people some trouble. Thanks again. ;) |
Hello guys!
|
|
Hello again.
See Attached: subshell.diff |
Well, patches in the closed ticket is not good idea. :)
About patch.
This is overkill. I (and most bush users) don't have this problem. But this bug is reproducible with (t)csh: #3063. But I personally not so familiar with various shell internals to 1) know what and why this happens exactly and 2) fix this correctly. |
How is this still an issue?
HISTCONTROL=ignoredups totally wreaks havoc as I get sh*ty entries in my bash history.
Please fix ASAP.
This is not mentioned anywhere in the documentation - you could at least add this as a warning. |
This is reproducible in Fedora 29/MC 4.8.21. |
Hmmm, I don't have any problems with garbage history entries on Fedora 29 with stock mc package and default user settings. What is the problem that you are facing and how to reproduce it? |
I have this problem too on Alpine Linux 3.11 (default with busybox). But if Bash is installed and set to $SHELL (on runtime or system wide) then the junk issue is no longer present.
|
|
|
I have checked the source code and it seems that BusyBox shells (ash/hush) don't support HISTCONTROL. I've sent a patch to busybox@busybox.net, for now it's bounced, no idea what happens next.
It seems that csh/tcsh only supports this:
No idea if we should set it when we fork the shell (but then user commands will be lost as well) or there is some way to do our business forking new instances all the time, but I guess not. |
Dash also has the same problem, interesting to talk to the developers, maybe they would agree to do HISTCONTROL: |
https://lore.kernel.org/dash/36590CFE-D82B-4A0D-A3A3-57434BADF6A7@shurup.com/T/#u |
No luck with Busybox list, posted to Bugzilla instead: https://bugs.busybox.net/show_bug.cgi?id=16213 |
|
csh/tsch ideas:
|
|
Important
This issue was migrated from Trac:
doktornotor
(notordoktor@….com)mc-trac@….de
,kyogre1@….ru
E.g., if I type cd /usr/portage/distfiles into a subshell in , the folloging will get logged:
The above is on Gentoo.
On FreeBSD, junk gets logged as well, e.g. cd /var/log produces:
#+1267704528
cd "printf "%b" '\0057var'"
#+1267704528
cd "printf "%b" '\0057var\0057log'"
Have had this problem for ages, valid with any app-misc/mc version incl. the latest masked 4.7.1. Happens semi-randomly and usually doesn't happen if I press Enter before typing into the subshell.
Reproduced on Gentoo and FreeBSD, have had this issue for ages. Currently using bash-4.1_p2 but as said above, it doesn't matter, been so for a long time.
Related downstream bug: http://bugs.gentoo.org/show_bug.cgi?id=309261
In case it matters:
$ echo $PS1
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]
If you need something else, let me know :)
Note
Original attachments:
Klimontov
(klimontovm@….ru) onSep 16, 2013 at 5:08 UTC
Klimontov
(klimontovm@….ru) onSep 16, 2013 at 5:08 UTC
The text was updated successfully, but these errors were encountered: