history not saved if a command begins with a space

Bug #106526 reported by Nicolò Chieffo
40
This bug affects 6 people
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

Binary package hint: bash

I'm running feisty (up to date) and I noticed that if I put a space before the command, it is not saved in the history:
it is not in .bash_histiry and it is not shown when using the up arrow.

I think this bug is here since an update that enabled the mouse wheel in applications like vim

Revision history for this message
C de-Avillez (hggdh2) wrote :

Please verify your environment variables; from the man page for bash:

 HISTCONTROL
              A colon-separated list of values controlling how commands are saved on the history list. If the list
              of values includes ignorespace, lines which begin with a space character are not saved in the history
              list. A value of ignoredups causes lines matching the previous history entry to not be saved. A
              value of ignoreboth is shorthand for ignorespace and ignoredups. A value of erasedups causes all
              previous lines matching the current line to be removed from the history list before that line is
              saved. Any value not in the above list is ignored. If HISTCONTROL is unset, or does not include a
              valid value, all lines read by the shell parser are saved on the history list, subject to the value
              of HISTIGNORE. The second and subsequent lines of a multi-line compound command are not tested, and
              are added to the history regardless of the value of HISTCONTROL.

Changed in bash:
assignee: nobody → hggdh2
importance: Undecided → Medium
status: Unconfirmed → Needs Info
Revision history for this message
Nicolò Chieffo (yelo3) wrote : Re: [Bug 106526] Re: history not saved if a command begins with a space

HISTCONTROL: "ignoreboth"
HISTIGNORE is empty

is this the default now?

Revision history for this message
C de-Avillez (hggdh2) wrote :

I am not sure, Nicolò, and will try to find out. Did you do a fresh install on this feisty? Or was it an upgrade?

Also -- where is HISTCONTROL being set: your own ~/.bashrc, or in /etc/bash.bashrc?

Revision history for this message
C de-Avillez (hggdh2) wrote :

Hum. Would you have the sysprofile package installed?

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

I've done a fresh feisty install lots of time ago... and now I'm dist upgrading

the only HISTCONTROL that I see is under /etc/skel/.bashrc (and of
course in my ~/.bashrc)

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

(there is no sense to export a variable and overwrite it immediately after...)

I don't have the package "sysprofile" but if I'm not sure some time
ago I installed (and removed) oprofile

Revision history for this message
C de-Avillez (hggdh2) wrote :

oprofile is used for profiling program execution, so I do not think this would be it.

bash has this distributed in /etc/skel/.bashrc, which is used to populate ~/.bashrc for a newly-created user. So... this is most certainly where it came from.

And... yes, bash_3.2-0ubuntu7.diff.gz does list the following:

+bash (3.2-0ubuntu1) feisty; urgency=low
+
+ * New upstream version.
(...)
+ * Set HISTCONTROL to ignoreboth. Ubuntu #66539.

So 3.2-0ubuntu7 (current bash) has it there as ignoreboth; actually, the patch seems to add both entries.

A look at bug 66539 indicates that since dapper bash has come with HISTCONTROL=ignoredups, so this is not actually new (I myself have no idea, since I moved to Ubuntu on Feisty). On the other hand, any new user created after installing 3.2-0ubuntu7 would have it set.

Nicolò, I tend to "this is not a bug". Do you agree?

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

this is not a bug because someone has decided to switch from
ignoredups to ignoreboth.
I don't really understand why lines starting with a space must be
ignored... I don't know what "mc" is (from the bug link you gave me),
but I surely know that this behaviour is not like it used to be in the
previous versions

Revision history for this message
C de-Avillez (hggdh2) wrote :

mc is midnight commander.

Yes, it is certainly not like what it was.

Anyways... not a bug.

Changed in bash:
assignee: hggdh2 → nobody
status: Needs Info → Rejected
Revision history for this message
andrewm (andrew-mcguigan) wrote :

How about a bug that asks to change the default back to "ignoredups"? I've asked around the office and most folks with not expect commands beginning with a space to be ignored by default.

Revision history for this message
qji (qji) wrote :

I also hate this behavior. :( I don't care mc, I just expect bash stores my command history...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.