quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] Bugfixes: "delete" call to "pop" has wrong target; QUILT_DE


From: Joe Green
Subject: [Quilt-dev] Bugfixes: "delete" call to "pop" has wrong target; QUILT_DELETE_ARGS inherited by "pop"
Date: Tue, 06 Sep 2005 13:21:16 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

Hi,

I've found a couple of bugs in the delete command.

When deleting the top patch by calling "quilt delete" with no arguments, pop is called as "@QUILT@/pop -fq $patch". This doesn't pop that patch, it pops *to* that patch, so the operation fails. The "$patch" argument should be removed to pop the top patch.

Also, I have QUILT_DELETE_ARGS set to "-r --backup" in my .quiltrc, and these are passed on to "pop", which results in an error:

   getopt: invalid option -- r
   getopt: unrecognized option `--backup'
   Usage: quilt pop [-afRqv] [num|patch]

The first attached patch "quilt-delete_pop.patch" fixes these problems.

The second patch "quilt-quilt_command.patch" creates a patchfn "quilt_command()" which can be used to invoke subcommands. I think it would be good to apply this patch as well for consistency in how subcommands are called. One question on this patch is whether or not the QUILT_COMMAND variable should be set so that QUILT_*_ARGS are applied to the subcommands, or so that only the arguments passed in by the calling command are applied. This version does the latter.

--
Joe Green <address@hidden>
MontaVista Software, Inc.

Source: MontaVista Software, Inc. <address@hidden>
Type: Defect Fix
Disposition: submitted to http://savannah.nongnu.org/projects/quilt

There are a number of problems with the way "quilt pop" is invoked from
"quilt delete":

  - Unlike the old rpatch function, "pop <patch>" doesn't mean to remove
    that patch, but only up to that patch.  "pop" alone removes the top
    patch, which is what's wanted.

  - Invoking "quilt pop" as "@QUILT@/pop" breaks gen_tempfile, which
    expects $0 to be something like "quilt pop", and REALLY doesn't like
    slashes.  Using the call formulation in bin/quilt.in solves this.

  - QUILT_COMMAND=delete is passed on to pop, which means pop picks up
    QUILT_DELETE_ARGS, which may not work.  Setting QUILT_COMMAND=""
    for the call to pop solves this.

Index: quilt-0.42/quilt/delete.in
===================================================================
--- quilt-0.42.orig/quilt/delete.in
+++ quilt-0.42/quilt/delete.in
@@ -101,7 +101,7 @@ fi
 if is_applied $patch
 then
        if [ "$patch" != "$(top_patch)" ] || \
-          ! @QUILT@/pop -fq "$patch"
+          ! QUILT_COMMAND= @BASH@ $BASH_OPTS -c ". @QUILT@/pop" "quilt pop" -fq
        then
                printf $"Patch %s is currently applied\n" \
                       "$(print_patch $patch)" >&2
Source: MontaVista Software, Inc. <address@hidden>
Type: Enhancement
Disposition: submitted to http://savannah.nongnu.org/projects/quilt

Use a standard function "quilt_command" to invoke one quilt command from
another.

Index: quilt-0.42/quilt/delete.in
===================================================================
--- quilt-0.42.orig/quilt/delete.in
+++ quilt-0.42/quilt/delete.in
@@ -100,8 +100,7 @@ else
 fi
 if is_applied $patch
 then
-       if [ "$patch" != "$(top_patch)" ] || \
-          ! QUILT_COMMAND= @BASH@ $BASH_OPTS -c ". @QUILT@/pop" "quilt pop" -fq
+       if [ "$patch" != "$(top_patch)" ] || ! quilt_command pop -fq
        then
                printf $"Patch %s is currently applied\n" \
                       "$(print_patch $patch)" >&2
Index: quilt-0.42/quilt/edit.in
===================================================================
--- quilt-0.42.orig/quilt/edit.in
+++ quilt-0.42/quilt/edit.in
@@ -6,6 +6,17 @@
 #
 #  See the COPYING and AUTHORS files for more details.
 
+# Read in library functions
+if [ "$(type -t patch_file_name)" != function ]
+then
+       if ! [ -r @SCRIPTS@/patchfns ]
+       then
+               echo "Cannot read library @SCRIPTS@/patchfns" >&2
+               exit 1
+       fi
+       . @SCRIPTS@/patchfns
+fi
+
 : ${EDITOR:=vi}
 
 usage()
@@ -48,7 +59,7 @@ then
        usage
 fi
 
-bash -c ". @QUILT@/add" "quilt add" "$@"
+quilt_command add "$@"
 status=$?
 if [ $status -ne 0 -a $status -ne 2 ]
 then
@@ -60,7 +71,7 @@ for file in "$@"
 do
        if ! [ -e "$file" ]
        then
-               bash -c ". @QUILT@/remove" "quilt remove" "$file"
+               quilt_command remove "$file"
                status=1
        fi
 done
Index: quilt-0.42/scripts/patchfns.in
===================================================================
--- quilt-0.42.orig/scripts/patchfns.in
+++ quilt-0.42/scripts/patchfns.in
@@ -753,6 +753,14 @@ setup_colors()
        eval $C
 }
 
+quilt_command ()
+{
+       local command=$1
+       shift
+
+       QUILT_COMMAND="" @BASH@ $BASH_OPTS -c ". @QUILT@/$command" "quilt 
$command" "$@"
+}
+
 #
 # If the working directory does not contain a $QUILT_PATCHES directory,
 # quilt searches for its base directory up the directory tree. If no

reply via email to

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