Bug 19894 - Urpmi completion don't work correctly with alias grep='grep --color=always'
Summary: Urpmi completion don't work correctly with alias grep='grep --color=always'
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal minor
Target Milestone: ---
Assignee: Mageia tools maintainers
QA Contact:
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2016-12-05 14:27 CET by Raphael Gertz
Modified: 2017-02-01 10:51 CET (History)
1 user (show)

See Also:
Source RPM: urpmi-8.105-1.mga6.src.rpm
CVE:
Status comment:


Attachments
Fix urpmi completion script to skip grep and sed aliases. (957 bytes, patch)
2017-02-01 10:27 CET, Raphael Gertz
Details | Diff

Description Raphael Gertz 2016-12-05 14:27:49 CET
Description of problem:
urpmi bash completion trust aliases of sed and grep where it shouldn't.

A possible fix would be to force 
Please change line 11 in /etc/bash_completion.d/urpmi to :
        | \sed -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/ /\\ /g' ) )

Please change line 27 in /etc/bash_completion.d/urpmi to :
        | \grep "^${cur//\\\\/}" ` )

Please change line 48 in /etc/bash_completion.d/urpmi to :
COMPREPLY=( $( compgen -W "$(urpmq $options --list | \grep ^$cur )" -- ) )

The backslash will disable any alias on sed or grep.

An unalias sed 2>/dev/null or unalias grep 2>/dev/null is an other option.

Version-Release number of selected component (if applicable):
urpmi-8.105-1.mga6

How reproducible:
Always

Steps to Reproduce:
1. echo "alias grep='grep --color=always'" >> ~/.bashrc
2. . ~/.bashrc
3. urpmi varni<tab>
4. urpmi ^[[01;31m^[[Kvarni^[[m^[[Ksh
Rémi Verschelde 2016-12-05 14:29:51 CET

Assignee: bugsquad => mageiatools
Severity: normal => minor

Comment 1 Raphael Gertz 2017-02-01 10:27:27 CET
Created attachment 8920 [details]
Fix urpmi completion script to skip grep and sed aliases.
Samuel Verschelde 2017-02-01 10:28:31 CET

Keywords: (none) => PATCH

Comment 2 Mageia Robot 2017-02-01 10:47:16 CET
commit 257cc397753fc1b669e7cc8c5435d7f11202847a
Author: Nicolas Lécureuil <neoclust@...>
Date:   Wed Feb 1 10:46:59 2017 +0100

     Fix bash completion to not trust aliases (mga#19894) Patch from rapsys
---
 Commit Link:
   http://gitweb.mageia.org/software/rpm/urpmi/commit/?id=257cc397753fc1b669e7cc8c5435d7f11202847a
Comment 3 Nicolas Lécureuil 2017-02-01 10:51:52 CET
tested and works OK for me

Status: NEW => RESOLVED
CC: (none) => mageia
Resolution: (none) => FIXED


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