Subject: bin/32524: diff and patch break on pathnames with spaces
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <collver@peak.org>
List: netbsd-bugs
Date: 01/14/2006 21:20:00
>Number:         32524
>Category:       bin
>Synopsis:       diff and patch break on pathnames with spaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 14 21:20:00 +0000 2006
>Originator:     collver@peak.org
>Release:        NetBSD 3.0
>Organization:
>Environment:
System: NetBSD sanctum 3.0 NetBSD 3.0 (SANCTUM) #0: Sun Dec 25 11:35:26 PST 2005 ben@sanctum:/home/ben/src/netbsd/3.0/src/sys/arch/i386/compile/SANCTUM i386
Architecture: i386
Machine: i386
>Description:
	When patching a file with a space in the path, patch fails to find
	the file.
>How-To-Repeat:
#!/bin/sh

test_patch()
{
  dir="$1"
  pfile=$2
  mkdir -p "$dir"
  cal >"$dir/cal.orig"
  cal | sed s/200/z200/ >"$dir/cal"
  diff -u "$dir/cal.orig" "$dir/cal" >$pfile
  rm "$dir/cal.orig" "$dir/cal"
  cal >"$dir/cal"
  patch -p0 <$pfile
}

good="foobar"
test_patch "$good" cal1.diff

bad="foo bar"
test_patch "$bad" cal2.diff
>Fix:
	Unknown.