unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 23.0.60; diff-apply-hunk new line at end of file
@ 2008-04-24 23:23 Markus Triska
  2008-04-24 23:42 ` Miles Bader
  2008-04-25  1:37 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Triska @ 2008-04-24 23:23 UTC (permalink / raw)
  To: emacs-pretest-bug


When I have t.patch with the following content:

diff --git a/t.txt b/t.txt
index f27f040..27bd94f 100644
--- a/t.txt
+++ b/t.txt
@@ -1 +1,2 @@
 first line.
+

(available from: http://www.logic.at/prolog/t.patch )

and, in the same directory, t.txt with the following content:

first line.

(available from: http://www.logic.at/prolog/t.txt )

and do C-c C-a on the first and only hunk of t.patch, the patch is
applied. When I then do C-c C-a, another new line is unexpectedly
inserted at the end of t.txt. Arbitrarily many, if repeated.


In GNU Emacs 23.0.60.2 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-04-23 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
configured using `configure  '--disable-font-backend''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: 23.0.60; diff-apply-hunk new line at end of file
  2008-04-24 23:23 23.0.60; diff-apply-hunk new line at end of file Markus Triska
@ 2008-04-24 23:42 ` Miles Bader
  2008-04-25  0:22   ` Markus Triska
  2008-04-25  1:37 ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Miles Bader @ 2008-04-24 23:42 UTC (permalink / raw)
  To: Markus Triska; +Cc: emacs-pretest-bug

Markus Triska <markus.triska@gmx.at> writes:
> and do C-c C-a on the first and only hunk of t.patch, the patch is
> applied. When I then do C-c C-a, another new line is unexpectedly
> inserted at the end of t.txt. Arbitrarily many, if repeated.

That's because there isn't enough context in the hunk.  It's a general
problem with the patch format.

-Miles

-- 
"I distrust a research person who is always obviously busy on a task."
   --Robert Frosch, VP, GM Research




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 23.0.60; diff-apply-hunk new line at end of file
  2008-04-24 23:42 ` Miles Bader
@ 2008-04-25  0:22   ` Markus Triska
  2008-04-25  0:38     ` Markus Triska
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Triska @ 2008-04-25  0:22 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-pretest-bug

Miles Bader <miles@gnu.org> writes:

> That's because there isn't enough context in the hunk.

A good guess from the hunk is that the context was at least 1 line, thus
it could be seen that the new line must be the last one in the file, no?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 23.0.60; diff-apply-hunk new line at end of file
  2008-04-25  0:22   ` Markus Triska
@ 2008-04-25  0:38     ` Markus Triska
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Triska @ 2008-04-25  0:38 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-pretest-bug


>> That's because there isn't enough context in the hunk.

I now see what you mean - you're right, this cannot be fixed. Thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 23.0.60; diff-apply-hunk new line at end of file
  2008-04-24 23:23 23.0.60; diff-apply-hunk new line at end of file Markus Triska
  2008-04-24 23:42 ` Miles Bader
@ 2008-04-25  1:37 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2008-04-25  1:37 UTC (permalink / raw)
  To: Markus Triska; +Cc: emacs-pretest-bug

> diff --git a/t.txt b/t.txt
> index f27f040..27bd94f 100644
> --- a/t.txt
> +++ b/t.txt
> @@ -1 +1,2 @@
>  first line.
> +

> (available from: http://www.logic.at/prolog/t.patch )

> and, in the same directory, t.txt with the following content:

> first line.

> (available from: http://www.logic.at/prolog/t.txt )

> and do C-c C-a on the first and only hunk of t.patch, the patch is
> applied. When I then do C-c C-a, another new line is unexpectedly
> inserted at the end of t.txt. Arbitrarily many, if repeated.

Why would that be a bug?  The patch doesn't say that it is at the end of
the file, so all it says is "add an empty line after the line `first
line'".  You may argue that the lack of context is an indication that
it's meant to be at the end-of-file, but that lack of context may be due
to something else.

Furthermore, the same kind of problem can happen even with 3-lines of
context, such that after applying the patch, the new file's content
still contains the pattern required for the patch be applied.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-25  1:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-24 23:23 23.0.60; diff-apply-hunk new line at end of file Markus Triska
2008-04-24 23:42 ` Miles Bader
2008-04-25  0:22   ` Markus Triska
2008-04-25  0:38     ` Markus Triska
2008-04-25  1:37 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).