{"thread":{"id":"17544","subject":"[PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","startedAt":"2009-02-04T01:50:15Z","lastAt":"2009-02-04T16:44:35Z","messageCount":5,"participants":["Johannes Schindelin","Junio C Hamano","Don Zickus","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"103058","messageId":"alpine.DEB.1.00.0902040249030.9822@pacific.mpi-cbg.de","threadId":"17544","inReplyTo":"cover.1233712140u.git.johannes.schindelin@gmx.de","subject":"[PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-04T01:50:15Z","receivedAt":"2009-02-04T01:50:15Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When 'tpatch' was initialized successfully, st_mode was already taken\nfrom the previous diff.  We should not try to override it with data\nfrom an lstat() that was never called.\n\nThis is a companion patch to 7a07841(git-apply: handle a patch that\ntouches the same path more than once better).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin-apply.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex 1e7f917..f312798 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -2441,7 +2441,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s\n \t\treturn error(\"%s: %s\", old_name, strerror(errno));\n \t}\n \n-\tif (!cached)\n+\tif (!cached && !tpatch)\n \t\tst_mode = ce_mode_from_stat(*ce, st->st_mode);\n \n \tif (patch->is_new < 0)\n-- \n1.6.1.2.582.g3fdd5\n"},{"id":"103075","messageId":"7vljsm4pb1.fsf@gitster.siamese.dyndns.org","threadId":"17544","inReplyTo":"alpine.DEB.1.00.0902040249030.9822@pacific.mpi-cbg.de","subject":"Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-04T07:46:42Z","receivedAt":"2009-02-04T07:46:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Looks correct; thanks.\n"},{"id":"103137","messageId":"20090204143634.GY3827@redhat.com","threadId":"17544","inReplyTo":"alpine.DEB.1.00.0902040249030.9822@pacific.mpi-cbg.de","subject":"Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","fromName":"Don Zickus","fromEmail":"dzickus@redhat.com","sentAt":"2009-02-04T14:36:34Z","receivedAt":"2009-02-04T14:36:34Z","isPatch":true,"sender":{"key":"dzickus@redhat.com","avatar":null},"body":"On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:\n> When 'tpatch' was initialized successfully, st_mode was already taken\n> from the previous diff.  We should not try to override it with data\n> from an lstat() that was never called.\n\nheh, oops.  thanks.\n\nAcked-by:  Don Zickus <dzickus@redhat.com>\n"},{"id":"103150","messageId":"20090204153150.GC6896@sigill.intra.peff.net","threadId":"17544","inReplyTo":"alpine.DEB.1.00.0902040249030.9822@pacific.mpi-cbg.de","subject":"Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-04T15:31:50Z","receivedAt":"2009-02-04T15:31:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:\n\n> When 'tpatch' was initialized successfully, st_mode was already taken\n> from the previous diff.  We should not try to override it with data\n> from an lstat() that was never called.\n\nYay. Valgrind For The Win, as the kids are saying these days.\n\nWas this being triggered by t4121 and t4127? If so, then I think it\nsolves the mystery valgrind errors I reported in the last paragraph\nhere:\n\n  http://article.gmane.org/gmane.comp.version-control.git/98898\n\n-Peff\n"},{"id":"103164","messageId":"alpine.DEB.1.00.0902041743530.22763@intel-tinevez-2-302","threadId":"17544","inReplyTo":"20090204153150.GC6896@sigill.intra.peff.net","subject":"Re: [PATCH] apply: fix access to an uninitialized mode variable, found by valgrind","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-04T16:44:35Z","receivedAt":"2009-02-04T16:44:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 4 Feb 2009, Jeff King wrote:\n\n> On Wed, Feb 04, 2009 at 02:50:15AM +0100, Johannes Schindelin wrote:\n> \n> > When 'tpatch' was initialized successfully, st_mode was already taken\n> > from the previous diff.  We should not try to override it with data\n> > from an lstat() that was never called.\n> \n> Yay. Valgrind For The Win, as the kids are saying these days.\n\nYes, indeed.\n\n> Was this being triggered by t4121 and t4127? If so, then I think it \n> solves the mystery valgrind errors I reported in the last paragraph \n> here:\n> \n>   http://article.gmane.org/gmane.comp.version-control.git/98898\n\nYep, t4121 and t4127.  But I did not have time to follow the link.\n\nCiao,\nDscho\n"}]}