Bug 520632 - Command prefixed with a spaces does not appear in history.
Summary: Command prefixed with a spaces does not appear in history.
Alias: None
Product: Fedora
Classification: Fedora
Component: setup
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
: 542184 (view as bug list)
Depends On:
Blocks: 542677
TreeView+ depends on / blocked
Reported: 2009-09-01 14:23 UTC by Eduard Benes
Modified: 2009-12-03 09:42 UTC (History)
5 users (show)

Fixed In Version: setup-2.8.11-1.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 542677 (view as bug list)
Last Closed: 2009-12-03 09:42:53 UTC

Attachments (Terms of Use)

Description Eduard Benes 2009-09-01 14:23:29 UTC
Description of problem:
Command prefixed with a spaces does not appear in history. 

# rpm -q bash
#      rpm -q bash
# history | tail -n 2
  172  rpm -q bash
  173  history | tail -n 2

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. execute command from a bash shell prefixed with a spaces: 
   $     ls

2. And see that it does not appear in bash history:
   $ history
Actual results:
executed command (here ls) does not appear in the history

Expected results:
executed command is in the history

Comment 1 Roman Rakus 2009-09-04 08:05:17 UTC
I can confirm the problem is in rawhide. But in F11 (with bash-4.0.28) I can't reproduce it.

Comment 2 Roman Rakus 2009-09-04 10:12:50 UTC
This can be controlled by HISTCONTROL shell variable. For more you can look at man page of bash.

Comment 3 Roman Rakus 2009-11-30 11:51:21 UTC
*** Bug 542184 has been marked as a duplicate of this bug. ***

Comment 4 David Woodhouse 2009-11-30 12:43:28 UTC
Ah, the problem is that /etc/profile has changed (as a result of bug #500819) to make this horrid behaviour happen by default.

That change seems like it was a bad idea.

Reopening bug and assigning to setup.

Comment 5 Ondrej Vasik 2009-11-30 13:44:19 UTC
I wouldn't call it regression, maybe just changing the defaults. HISTCONTROL="ignoreboth" is default on other relevant Linux distros - so I wouldn't call it horrid. Sometimes HISTCONTROL=ignorespace might be intentional E.g. midnight commander uses HISTCONTROL="ignorespace" to hide some commands sent to bash by subshell.

I had a discussion with the guy who reported #500819, because initially I thought about adding just ignoredups. Maybe I could change it to 

if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
    export HISTCONTROL=ignoredups

as I see ignoredups useful  - and it doesn't break midnight commander behaviour with ignorespace - and will show your space prefixed commands in history in normal shell.

Comment 6 David Woodhouse 2009-11-30 14:44:17 UTC
I'm not that keen on ignoredups either, although it's not quite as bad as ignorespace. It breaks long-established use patterns where you have a bunch of commands, some of which may be repetitions, and you can repeat them all, repeatedly, by hitting <UP> <UP> <UP> <UP> <UP> <ENTER>, for example.

I really don't think we should have changed the default at all. Midnight commander can set what it likes anyway, can't it? As can users who want different behaviour.

Comment 7 Ondrej Vasik 2009-11-30 15:58:54 UTC
I don't like if one distribution has unnecessarily default X, second one has default Y, third has default Z. From what I have seen, ignoreboth/ignoredups is used as default on quite a big number of Linux systems. They usually enabled ignoredups and then after complains from mc users they enabled ignoreboth. This "if expression" should handle this - so no need for that.

Defaults in various distros:
Debian: ignoreboth (because of mc, it was ignoredups before)
Ubuntu: ignoreboth (because of mc, it was ignoredups before)
Mandriva: ignoredups
OpenSuse: ignoreboth (afaik, bacause of mc, before it was ignoredups)
Gentoo: ignoreboth (afaik)

Everyone could change the behaviour on his machine easily, so you could change files in your home directory only and you are done. As the ignoreboth was usually added because of mc (and that's solvable other way), I tend to keep ignoredups - as anyone could disable it and it keeps the shell behaviour consistent on most of Linux distros.

Comment 8 Ondrej Vasik 2009-12-03 09:42:53 UTC
Ok, changed to the style from comment #5 - fixed in RAWHIDE - setup-2.8.11-1.fc13, closing.

Note You need to log in before you can comment on or make changes to this bug.