Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Apr 1997 22:52:57 +0200 (CEST)
From:      Philippe Charnier <charnier@xp11.frmug.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   gnu/3176: `patch' creates files in wrong places (following Index)
Message-ID:  <199704022052.WAA05260@xp11.frmug.org>
Resent-Message-ID: <199704022100.NAA23945@freefall.freebsd.org>

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

>Number:         3176
>Category:       gnu
>Synopsis:       `patch' creates files in wrong places
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr  2 13:00:01 PST 1997
>Last-Modified:
>Originator:     Philippe Charnier
>Organization:
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	

>Description:

	

>How-To-Repeat:

mkdir -p a-1.0/b
then create the patch file (called file.patch):
	Index: b/file
	--- /dev/null   Wed Apr  2 20:33:10 1997
	+++ a-2.0/b/file        Wed Apr  2 21:58:35 1997
	@@ -0,0 +1 @@
	+version 2

cd a-1.0
patch -p1 -N < ../file.patch
	Hmm...  Looks like a unified diff to me...
	The text leading up to this was:
	--------------------------
	|Index: b/file
	|--- /dev/null  Wed Apr  2 20:33:10 1997
	|+++ a-2.0/b/file       Wed Apr  2 21:58:35 1997
	--------------------------
	(Creating file file...)                 <------------- should be b/file
	Patching file file using Plan A...
	Hunk #1 succeeded at 1.
	done

>Fix:
	
If the line `Index: b/file' is not provided, the command works as expected. If
not, the -p1 option is applied against Index. Maybe something like that:
in pch.c
  - indname = fetchname(indtmp, strippath, ok_to_create_file);
  + indname = fetchname(indtmp, 957, ok_to_create_file);

  - bestguess = fetchname(indtmp, strippath, TRUE);
  + bestguess = fetchname(indtmp, 957, TRUE);


Obtained when trying to patch perl (-p1 -N):

Index: lib/ExtUtils/Command.pm
*** /dev/null   Fri Mar 21 23:14:07 1997
--- perl5.003_94/lib/ExtUtils/Command.pm        Fri Mar 21 21:45:47 1997
***************

Creates ExtUtils/Command.pm instead of lib/ExtUtils/Command.pm

ps: /usr/src/gnu/usr.bin/patch/* contains $Log$ that should be removed.
>Audit-Trail:
>Unformatted:



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