This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 520632 - Command prefixed with a spaces does not appear in history.
Command prefixed with a spaces does not appear in history.
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
: Reopened
: 542184 (view as bug list)
Depends On:
Blocks: 542677
  Show dependency treegraph
 
Reported: 2009-09-01 10:23 EDT by Eduard Benes
Modified: 2009-12-03 04:42 EST (History)
5 users (show)

See Also:
Fixed In Version: setup-2.8.11-1.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 542677 (view as bug list)
Environment:
Last Closed: 2009-12-03 04:42:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Eduard Benes 2009-09-01 10:23:29 EDT
Description of problem:
Command prefixed with a spaces does not appear in history. 

# rpm -q bash
bash-4.0.28-1.fc12.i686
#      rpm -q bash
bash-4.0.28-1.fc12.i686
# history | tail -n 2
  172  rpm -q bash
  173  history | tail -n 2

Version-Release number of selected component (if applicable):
bash-4.0.28-1.fc12

How reproducible:
always

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 04:05:17 EDT
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 06:12:50 EDT
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 06:51:21 EST
*** Bug 542184 has been marked as a duplicate of this bug. ***
Comment 4 David Woodhouse 2009-11-30 07:43:28 EST
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 08:44:19 EST
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
else
    export HISTCONTROL=ignoredups
fi

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 09:44:17 EST
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 10:58:54 EST
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 04:42:53 EST
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.