1 --- bash_completion/bash_completion~ 2006-03-01 18:20:18.000000000 +0200
2 +++ bash_completion/bash_completion 2008-01-08 02:50:17.000000000 +0200
3 @@ -1732,29 +1732,20 @@
5 _rpm_installed_packages()
7 - local ver nodig nosig
8 + # refresh cache if writable
9 + if [ /var/cache/rpmpkgs.txt -ot /var/lib/rpm/Packages -a -w /var/cache/rpmpkgs.txt ]; then
10 + # we grab the output to local variable to prevent possible race
11 + local tmp=$(rpm -qa --nodigest --nosignature --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' | LC_ALL=C sort)
12 + echo "$tmp" > /var/cache/rpmpkgs.txt
15 - if [ -r /var/log/rpmpkgs -a \
16 - /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
17 + if [ -r /var/cache/rpmpkgs.txt -a /var/cache/rpmpkgs.txt -nt /var/lib/rpm/Packages ]; then
18 # using RHL 7.2 or later - this is quicker than querying the DB
19 COMPREPLY=( $( sed -ne \
20 - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \
21 - /var/log/rpmpkgs ) )
22 + 's|^\('$cur'.*\)\.rpm$|\1|p' \
23 + /var/cache/rpmpkgs.txt ) )
27 - ver=$(rpm --version)
30 - if [[ "$ver" > "4.0.4" ]]; then
33 - if [[ "$ver" > "4.0.99" ]]; then
34 - nosig="--nosignature"
37 - COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \
38 - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) )
39 + COMPREPLY=( $( rpm -qa --nodigest --nosignature --qf '%{name}-%{version}-%{release}.%{arch}\n' "$cur*" ) )