Subject: bin/19827: /usr/bin/patch coredumps under some conditions
To: None <gnats-bugs@gnats.netbsd.org>
From: Toru TAKAMIZU <ttaka@earth.email.ne.jp>
List: netbsd-bugs
Date: 01/13/2003 10:26:21
>Number:         19827
>Category:       bin
>Synopsis:       /usr/bin/patch coredumps under some conditions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 12 17:27:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Toru TAKAMIZU
>Release:        NetBSD 1.6_STABLE
>Organization:
>Environment:
System: NetBSD localhost 1.6_STABLE NetBSD 1.6_STABLE (MIWA) #22: Sun Jan 12 22:38:43 JST 2003 toru@localhost:/usr/src/sys/arch/i386/compile/MIWA i386
Architecture: i386
Machine: i386
>Description:

/usr/bin/patch coredumps under some conditions. I don't know this is 
related to bin/5123. I attach a testcase below.

>How-To-Repeat:

Extract the attached test.tar.gz and cd into the directory "test".
Press "enter" when asked "File to patch: ". Answer "y" when prompted
"No file found--skip this patch? [n] ".

[toru@sajima ~/temp/temp/test]% patch < diff-file
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: Makefile
|===================================================================
|RCS file: /cvsroot/pkgsrc/wm/evilwm/Makefile,v
|retrieving revision 1.2
|diff -u -r1.2 Makefile
|--- Makefile    2002/03/04 15:56:37     1.2
|+++ Makefile    2002/12/03 22:29:06
--------------------------
Patching file Makefile using Plan A...
Hunk #1 failed at 1.
1 out of 1 hunks failed--saving rejects to Makefile.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|
| 
--------------------------
File to patch: 
No file found--skip this patch? [n] y
Skipping patch...
zsh: segmentation fault (core dumped)  patch < diff-file

================== test case ================================
begin 644 test.tar.gz
M'XL(".(1(CX"`W1E<W0N=&%R`.V5;4_J,!3'>4L_Q8GZ#K>V8\!U"0D3=KE$
M!V:;T?N*S%%@86QD&VI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