Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 2000 04:41:11 -0700 (PDT)
From:      kbyanc@posi.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   gnu/19638: patch's --skip/-S option doesn't skip when target doesn't exist
Message-ID:  <200007021141.EAA88314@vaio>

next in thread | raw e-mail | index | archive | help

>Number:         19638
>Category:       gnu
>Synopsis:       patch's --skip/-S option doesn't skip when target doesn't exist
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 02 04:40:04 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Kelly Yancey
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

FreeBSD backroom.corp.ONElist.com 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Fri
Jun 30 13:47:43 PDT 2000
root@backroom.corp.ONElist.com:/usr/src/sys/compile/BACKROOM  i386
 
>Description:

	patch (as found in /usr/src/gnu/usr.bin/patch) does not honor -S
	(--skip) parameter when the target of the patchfile to skip does not
	exist. For example, if you used a command line such as:
		patch -p1 + -p2 + -S < my.diff
	to skip the third patchfile in the set, patch will prompt for the
	name of the file to patch (because it doesn't exist), even though
	it is to skip it.

	This patch addresses the issue on the simplest level. It still
	writes the 'skipped' patchfile out as a reject file (always named
	'Oops.rej' since the target filename doesn't exist). It is
	debatable as to whether writing the reject file is correct for a
	skipped patch.

	-Kelly

>How-To-Repeat:

	$ echo "this is a test" > file-a
	$ echo "this is another test" > file-b
	$ diff file-a file-b > diff-ab
	$ rm file-b
	$ patch -S < diff-ab

>Fix:

cvs diff: Diffing gnu/usr.bin/patch/
Index: gnu/usr.bin/patch//pch.c
===================================================================
RCS file: /home/cvs/src/gnu/usr.bin/patch/pch.c,v
retrieving revision 1.16
diff -u -r1.16 pch.c
--- gnu/usr.bin/patch//pch.c    1999/09/05 17:31:55     1.16
+++ gnu/usr.bin/patch//pch.c    2000/07/02 11:10:28
@@ -173,7 +173,7 @@
     if (p_indent && verbose)
 	say3("(Patch is indented %d space%s.)\n", p_indent, p_indent==1?"":"s");
     skip_to(p_start,p_sline);
-    while (filearg[0] == Nullch) {
+    while (!skip_rest_of_patch && filearg[0] == Nullch) {
 	if (force || batch) {
 	    say1("No file to patch.  Skipping...\n");
 	    filearg[0] = savestr(bestguess);


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007021141.EAA88314>