git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind
       [not found] <cover.1233712140u.git.johannes.schindelin@gmx.de>
@ 2009-02-04  1:50 ` Johannes Schindelin
  2009-02-04  7:46   ` Junio C Hamano
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Johannes Schindelin @ 2009-02-04  1:50 UTC (permalink / raw)
  To: git; +Cc: gitster, Don Zickus

When 'tpatch' was initialized successfully, st_mode was already taken
from the previous diff.  We should not try to override it with data
from an lstat() that was never called.

This is a companion patch to 7a07841(git-apply: handle a patch that
touches the same path more than once better).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 1e7f917..f312798 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2441,7 +2441,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
 		return error("%s: %s", old_name, strerror(errno));
 	}
 
-	if (!cached)
+	if (!cached && !tpatch)
 		st_mode = ce_mode_from_stat(*ce, st->st_mode);
 
 	if (patch->is_new < 0)
-- 
1.6.1.2.582.g3fdd5

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

* Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind
  2009-02-04  1:50 ` [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind Johannes Schindelin
@ 2009-02-04  7:46   ` Junio C Hamano
  2009-02-04 14:36   ` Don Zickus
  2009-02-04 15:31   ` Jeff King
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2009-02-04  7:46 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Don Zickus

Looks correct; thanks.

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

* Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind
  2009-02-04  1:50 ` [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind Johannes Schindelin
  2009-02-04  7:46   ` Junio C Hamano
@ 2009-02-04 14:36   ` Don Zickus
  2009-02-04 15:31   ` Jeff King
  2 siblings, 0 replies; 5+ messages in thread
From: Don Zickus @ 2009-02-04 14:36 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, gitster

On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:
> When 'tpatch' was initialized successfully, st_mode was already taken
> from the previous diff.  We should not try to override it with data
> from an lstat() that was never called.

heh, oops.  thanks.

Acked-by:  Don Zickus <dzickus@redhat.com>

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

* Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind
  2009-02-04  1:50 ` [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind Johannes Schindelin
  2009-02-04  7:46   ` Junio C Hamano
  2009-02-04 14:36   ` Don Zickus
@ 2009-02-04 15:31   ` Jeff King
  2009-02-04 16:44     ` Johannes Schindelin
  2 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2009-02-04 15:31 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, gitster, Don Zickus

On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:

> When 'tpatch' was initialized successfully, st_mode was already taken
> from the previous diff.  We should not try to override it with data
> from an lstat() that was never called.

Yay. Valgrind For The Win, as the kids are saying these days.

Was this being triggered by t4121 and t4127? If so, then I think it
solves the mystery valgrind errors I reported in the last paragraph
here:

  http://article.gmane.org/gmane.comp.version-control.git/98898

-Peff

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

* Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind
  2009-02-04 15:31   ` Jeff King
@ 2009-02-04 16:44     ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2009-02-04 16:44 UTC (permalink / raw)
  To: Jeff King; +Cc: git, gitster, Don Zickus

Hi,

On Wed, 4 Feb 2009, Jeff King wrote:

> On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:
> 
> > When 'tpatch' was initialized successfully, st_mode was already taken
> > from the previous diff.  We should not try to override it with data
> > from an lstat() that was never called.
> 
> Yay. Valgrind For The Win, as the kids are saying these days.

Yes, indeed.

> Was this being triggered by t4121 and t4127? If so, then I think it 
> solves the mystery valgrind errors I reported in the last paragraph 
> here:
> 
>   http://article.gmane.org/gmane.comp.version-control.git/98898

Yep, t4121 and t4127.  But I did not have time to follow the link.

Ciao,
Dscho

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

end of thread, other threads:[~2009-02-04 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1233712140u.git.johannes.schindelin@gmx.de>
2009-02-04  1:50 ` [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind Johannes Schindelin
2009-02-04  7:46   ` Junio C Hamano
2009-02-04 14:36   ` Don Zickus
2009-02-04 15:31   ` Jeff King
2009-02-04 16:44     ` Johannes Schindelin

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 NNTP newsgroup(s).