git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andrey Okoshkin <a.okoshkin@samsung.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	pclouds@gmail.com, Ivan Arishchenko <i.arishchenk@samsung.com>
Subject: Re: [PATCH] diff: fix lstat() error handling in diff_populate_filespec()
Date: Sat, 28 Oct 2017 01:35:54 +0900	[thread overview]
Message-ID: <xmqq3764czv9.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <72e8146b-d4ab-ad7e-6afd-9168806eeca2@samsung.com> (Andrey Okoshkin's message of "Fri, 27 Oct 2017 12:33:25 +0300")

Andrey Okoshkin <a.okoshkin@samsung.com> writes:

> I'm not sure why only ENOENT error of lstat() is considered as an
> error but passing by other errno values leads to reading of
> uninitialized 'struct stat st' variable.  It means that the
> populated 'diff_filespec' structure may be incorrectly filled.

Entirely correct.  There is no fundamental reason to try special
casing ENOENT, unless we are clearing the "this is an error" bit
when the errno is ENOENT---but this code does not even do so.  All
errors are errors---we wanted to know the result of lstat() to carry
on, and we couldn't figure out the status.  We do not want to die
immediately (instead we want to show diffs for other paths), so
substituting the result with an empty string is the least bad thing
we can do at this point in the code.


  reply	other threads:[~2017-10-27 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171027093331epcas2p1a945263c12b8ba608492693da4e3eff2@epcas2p1.samsung.com>
2017-10-27  9:33 ` [PATCH] diff: fix lstat() error handling in diff_populate_filespec() Andrey Okoshkin
2017-10-27 16:35   ` Junio C Hamano [this message]
2017-10-27 16:58     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq3764czv9.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=a.okoshkin@samsung.com \
    --cc=git@vger.kernel.org \
    --cc=i.arishchenk@samsung.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.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).