helpThe GNU Bourne-Again SHell - Support: sr #108530, History duplicates with multiple...

 
 

sr #108530: History duplicates with multiple sessions

Submitted by:  Balaco <balacobaco>
Submitted on:  Thu Mar 13 08:14:09 2014  
Votes:  40  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: Postponed
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed Nov 11 23:33:21 2015, comment #5:

I never looked at Bash's source code. For its popularity, I have guessed that many others would know it much better than I can do for the first time. Although I have a good familiarity with Bash scripts, source code is not exactly guaranteed to be easier with that.

In a few days I may expend a few hours with your ideas. If needed, would you help it to progress?

Balaco <balacobaco>
Wed Nov 11 21:18:44 2015, comment #4:

There are two utilities distributed with readline that can remove commands from history files. hist_erasedups removes duplicate commands from a history file, and hist_purgecmd removes commands matching a pattern or string.

Readline is not well structured to remove duplicates when writing a history file because of the in-memory nature of the history list. That's why the utilities above exist.

If you would like to take a shot at taking the functions that do the work from the utilities and incorporating them into the history library itself, please do so and let me know what happens. You could add additional options to the bash `history' builtin to use them (maybe -E and -D).

Chet Ramey <chet>
Project Administrator
Wed Nov 11 20:12:20 2015, comment #3:

Not a solution, but something that can be useful to users until it is fixed:

http://unix.stackexchange.com/questions/48713/

Balaco <balacobaco>
Wed Nov 11 20:07:53 2015, comment #2:

Is there something I can do to help this problem starting being fixed?

The amount of users and discussions that happened with this bug isn't big enough to represent its importance?

https://duckduckgo.com/html/?q=bash+history+duplicate+remove

There are several discussions and partial fixes - mostly not easily repeatable or takes a few minutes.

Balaco <balacobaco>
Wed May 13 13:49:19 2015, comment #1:

Is there anyone reading here?,

Balaco <balacobaco>
Thu Mar 13 08:14:09 2014, original submission:

People who use history option 'erasedups' doesn't have it working in practice.

To easily make the problem happen we simply open 2 (or more) simultaneous sessions, or nested sessions (like ssh from access machine to other machines on a private network, very common).

Bash's history is kept right for an open session. When the session 1 closes it will write its history, no duplicates. But when the other session closes it won't account for duplicate commands done on the parallel session 1. Duplicates will grow very large this way.

Very bad side effect: a person choose HISTSIZE and HISTFILESIZE based on his/hers expectations. But the dups described make the practical history of different commands the person has much smaller than the desired values.

This is a very old bash issue, and simple internet searches show that people tried and try many odd things to overcome this problem. Can it be fixed and documented so we may use Bash's history in a better way?

The same problem happens when 2 nested sessions are closed abnormally, for example in a network failure.

Balaco <balacobaco>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by chet (Updated the item)
  • -unavailable- added by balacobaco (Voted in favor of this item)
  • -unavailable- added by balacobaco (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 40 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Nov 11 21:19:08 2015chetSeverity4 - Important=>3 - Normal
    Sat Jun 6 20:34:03 2015chetStatusNone=>Postponed
    Wed May 13 13:47:43 2015balacobacoCarbon-Copy-=>Added balacobaco

    Back to the top


    Powered by Savane 3.1-cleanup