Bug 19638

Summary: patch's --skip/-S option doesn't skip when target doesn't exist
Product: Base System Reporter: kbyanc <kbyanc>
Component: gnuAssignee: kbyanc
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description kbyanc 2000-07-02 12:40:04 UTC
	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

Fix: cvs diff: Diffing gnu/usr.bin/patch/
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
Comment 1 kbyanc 2000-07-09 02:06:19 UTC
  -f/--force will skip files that do not exist. Arguably, the solution is to
just accect the -s/--skip behaviour and use -f instead. I assert that this PR
still stands as -s/--skip should skip a patch whether the file that would
have been changed exists or not.

  Kelly

--
Kelly Yancey  -  kbyanc@posi.net  -  Belmont, CA
System Administrator, eGroups.com                  http://www.egroups.com/
Maintainer, BSD Driver Database       http://www.posi.net/freebsd/drivers/
Coordinator, Team FreeBSD        http://www.posi.net/freebsd/Team-FreeBSD/
Comment 2 kbyanc freebsd_committer freebsd_triage 2000-08-02 06:04:47 UTC
Responsible Changed
From-To: freebsd-bugs->kbyanc

Taking my own PR.
Comment 3 kbyanc freebsd_committer freebsd_triage 2000-08-02 07:56:56 UTC
State Changed
From-To: open->closed

Committed.