Bug 1294992

Summary: bash: reverse search often returns wrong finds from the history
Product: [Fedora] Fedora Reporter: Ali Akcaagac <aliakc>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: admiller, deekej
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-09 09:03:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ali Akcaagac 2015-12-31 14:37:31 UTC
Description of problem:

The behavior from Bash (Fedora 20 and previous) vs. Bash (Fedora 22 and maybe upwards) has changed.

I heavily use the reverse search (CTRL + R) within Bash to quickly find previously entered commands in the history list. Sadly with Fedora 22, the Bash that comes bundled with it changed the behavior and regulary wrong stuff is being returned.

The point here is: It heavily irritates the workflow and often causes huge damage of the workflow as well. While Bash from Fedora 20 returned *nothing* (forbid) any returns, if the search criteria wasn't found, the Bash from Fedora 20 usually returns *something* - even if it's not what you wanted.

In a quick type and return phase (nailing the keyboard), you may end up getting a wrong command from the history which may cause damage the to the system. For example you search 'mplayer' as a command that you keep running often, it may be that you get something like 'rm -rf *.mp4' returned which - if you quickly hit return by acciden - kills all the movies that you might have copied to said parition.

Within Fedora 20, if "mplayer" as search criteria wasn't found, then the reverse search won't return anything. With Fedora 22 things look differently and bash returns something.

This bothered me, since I switched to Fedora 22 and already caused some bad and irritating behavior (luckely nothing that couldn't be reversed because of backups).

I really like to see the bahavior changed back as it was in Fedora 20.

A real example as happened a few moments before (while typing this):

I had a 'chroot' command and a 'touch' command in history (amongst other commands). I was just working on the chroot and wanted to enter the chroot environment by executing the CTRL + R (followed by the search of 'chroot'). Rather than returning the full chroot command from my bash history, it executed another command that happens to be in the history "touch.sh /path". The touch.sh command is nothing else that a bash script containing "find <path> -exec touch -c -h -t 201512310000.00 {} \; (with automate date adding, so I don't need to enter the date all the time).

What I expect is the following (old) behavior:

a) If the command is NOT found in the history (or the history list)... return nothing.
b) If the command is NOT found in the history... avoid returning some other commands (that are fully unrelated to what's intended to be done).
c) If the command IS in the history... return exactly the command from the search criteria (the list can contain more similar commands of course, so you can cursor up and down, going through the history).

Or simply: Make Bash behave as it did with Fedora 20 and previous...

Right now as it is, it's far too dangerous by accidently executing an command that is not wanted to be executed - just because of the different behavior how Bash deals with history (as of Fedora 22... could be valid for Fedora 21 probably).

Thanks and happy new year.

Comment 2 Fedora End Of Life 2016-07-19 18:38:11 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Ali Akcaagac 2016-07-19 18:41:56 UTC
Reopened.

Comment 4 Ali Akcaagac 2017-08-09 09:03:51 UTC
Closing.... No response from maintainer!

Comment 5 Siteshwar Vashisht 2017-08-09 12:56:42 UTC
This is a behavior change introduced with Readline-6.3. If the completion fails, you can see 'failed reverse-i-search' at the prompt.