quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] 27111 - bash completion


From: Jean Delvare
Subject: Re: [Quilt-dev] 27111 - bash completion
Date: Wed, 18 Dec 2013 16:04:29 +0100

Le Monday 04 February 2013 à 09:12 +0100, Daniel Lovasko a écrit :
> I made some changes to make the patch without use of perl :)
> What do you think?

See https://savannah.nongnu.org/bugs/index.php?27111#comment2

While the patch indeed solves the problem, it adds complexity and comes
with a performance hit. 

The whole problem comes from QUILT_PATCHES_PREFIX=yes
in /etc/quilt.quiltrc. Most users (including me) have a ~/.quiltrc which
overrides /etc/quilt.quiltrc, without QUILT_PATCHES_PREFIX=yes in it, so
we were not affected by the bug. Without QUILT_PATCHES_PREFIX, quilt
series and other similar commands return absolute patch names, instead
of relative to the working directory. 

This explains why this bug could stay open for so long without being
looking into: I believe a significant share of users never hit it,
including the core quilt developers / maintainers. 

I think that a better solution to this problem is to disable
QUILT_PATCHES_PREFIX during bash completion. This can be done easily by
adding "--quiltrc -" to the command line of affected quilt commands
(series, applied and unapplied as far as I know) in the bash completion
script. This comes with no performance hit, in fact it may even make
things slightly faster. Patch follows:

bash_completion: Fix completion of patch names

When the user's quilt configuration file (~/.quiltrc or
/etc/quilt.quiltrc) contains QUILT_PATCHES_PREFIX=yes (and the
default /etc/quilt.quiltrc does), bash completion chokes on patch
names. This is because quilt series, applied and unapplied return
relative patch names instead of the expected absolute patch names.

This can be solved by skipping configuration files when quilt is
called from the bash completion script.

This fixes bug #27111:
https://savannah.nongnu.org/bugs/index.php?27111
---
 bash_completion |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

--- a/bash_completion
+++ b/bash_completion
@@ -123,7 +123,7 @@ _quilt_completion()
        add)
           case $prev in
             -P)
-               COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- 
$cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
                ;;
             *)
                _quilt_comfile
@@ -134,7 +134,7 @@ _quilt_completion()
        annotate)
           case $prev in
             -P)
-               COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- 
$cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
                ;;
             *)
                _quilt_comfile
@@ -143,10 +143,10 @@ _quilt_completion()
           esac
           ;;
        applied) 
-          COMPREPLY=( $( compgen -W "-h $(quilt applied 2>/dev/null)" -- $cur 
) )
+          COMPREPLY=( $( compgen -W "-h $(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
           ;;
        delete) 
-          COMPREPLY=( $( compgen -W "-n -r -h --backup $(quilt series)" -- 
$cur ) )
+          COMPREPLY=( $( compgen -W "-n -r -h --backup $(quilt --quiltrc - 
series)" -- $cur ) )
           ;;
        diff) 
           case $prev in
@@ -154,7 +154,7 @@ _quilt_completion()
                COMPREPLY=( $( compgen -W "0 1" -- $cur ) )
                ;;
             -P|--combine)
-               COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- 
$cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
                ;;
             --diff|-U|-C)
                ;;
@@ -171,10 +171,10 @@ _quilt_completion()
        files)
           case $prev in
             --combine)
-               COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- 
$cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
                ;;
             *)
-               COMPREPLY=( $( compgen -W "-a -l -v -h --combine $(quilt 
applied 2>/dev/null)" -- $cur ) )
+               COMPREPLY=( $( compgen -W "-a -l -v -h --combine $(quilt 
--quiltrc - applied 2>/dev/null)" -- $cur ) )
                ;;
           esac
           ;;
@@ -198,7 +198,7 @@ _quilt_completion()
                COMPREPLY=( $( compgen -W "files" -- $cur ) )
                ;;
             *)
-               COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines 
--edge-labels $(quilt applied 2>/dev/null)" -- $cur ) )
+               COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines 
--edge-labels $(quilt --quiltrc - applied 2>/dev/null)" -- $cur ) )
                ;;
           esac
           ;;
@@ -207,7 +207,7 @@ _quilt_completion()
           COMPREPLY=( address@hidden:-} $( compgen -W "-h" -- $cur ) )
           ;;
        header)
-          COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat 
--strip-trailing-whitespace $(quilt series)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat 
--strip-trailing-whitespace $(quilt --quiltrc - series)" -- $cur ) )
           ;;
        import)
           case $prev in
@@ -229,17 +229,17 @@ _quilt_completion()
           COMPREPLY=( $( compgen -W "-m --prefix --mbox --send --sender --from 
--subject --to --cc --bcc" -- $cur ) )
           ;;
        next|previous)
-          COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "$(quilt --quiltrc - series)" -- $cur ) )
           ;;
        patches)
           _quilt_comfile 
           COMPREPLY=( address@hidden:-} $( compgen -W "-v -h" -- $cur ) )
           ;;
        pop)
-          COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt applied 
2>/dev/null)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt --quiltrc - 
applied 2>/dev/null)" -- $cur ) )
           ;;
        push)
-          COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects 
--interactive --color $(quilt unapplied 2>/dev/null)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects 
--interactive --color $(quilt --quiltrc - unapplied 2>/dev/null)" -- $cur ) )
           ;;
        refresh)
           case $prev in
@@ -249,14 +249,14 @@ _quilt_completion()
             -U|-C)
                ;;
             *)
-               COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h $(quilt applied 
2>/dev/null) --no-timestamps --no-index --diffstat --sort --backup 
--strip-trailing-whitespace" -- $cur ) )
+               COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h $(quilt 
--quiltrc - applied 2>/dev/null) --no-timestamps --no-index --diffstat --sort 
--backup --strip-trailing-whitespace" -- $cur ) )
                ;;
           esac
           ;;
        remove|revert)
           case $prev in
             -P)
-               COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- 
$cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - applied 
2>/dev/null)" -- $cur ) )
                ;;
             *)
                _quilt_comfile 
@@ -267,7 +267,7 @@ _quilt_completion()
        rename)
           case $prev in
             -P)
-               COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) )
+               COMPREPLY=( $( compgen -W "$(quilt --quiltrc - series)" -- $cur 
) )
                ;;
             *)
                COMPREPLY=( $( compgen -W "-P -h" -- $cur ) )
@@ -292,7 +292,7 @@ _quilt_completion()
           COMPREPLY=( $( compgen -W "-d -h" -- $cur ) )
           ;;
        unapplied)
-          COMPREPLY=( $( compgen -W "-h $(quilt series)" -- $cur ) )
+          COMPREPLY=( $( compgen -W "-h $(quilt --quiltrc - series)" -- $cur ) 
)
           ;;
        fork|new|top|upgrade)
           ;;


I'll apply this if there is no objection.

-- 
Jean Delvare
Suse L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]