git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
	git@vger.kernel.org, Orgad and Raizel Shaneh <orgads@gmail.com>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Subject: Re: [PATCH v2 3/8] absolute_path(): reject the empty string
Date: Sun, 09 Sep 2012 06:48:06 +0200	[thread overview]
Message-ID: <504C1F86.4060608@alum.mit.edu> (raw)
In-Reply-To: <7vy5kmzr3e.fsf@alter.siamese.dyndns.org>

On 09/07/2012 01:09 AM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
> 
>> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
>> ---
> 
> I think I asked why this matters (iow, why it is the right thing to
> do to reject an empty string, instead of treating it as "the current
> directory") in the previous round.  I would have expected to find
> the answer be above the S-o-b line here.

The reasons that the change is desirable:

1. The empty string is not a legitimate path according to POSIX; e.g.,
see Linux's path_resolution(7):

   Empty pathname
       In the original UNIX, the empty pathname referred to the current
       directory.   Nowadays  POSIX  decrees  that  an  empty  pathname
       must not be resolved successfully.  Linux returns ENOENT in this
       case.

Accordingly, comparable standard functions like realpath(3) reject the
empty string.

2. The functions did not handle the empty path consistently with the way
they handled other paths (namely, the return value contained a trailing
slash).

3. This unusual behavior was undocumented.

The above points let me to the conclusion that the anomalous handling of
the empty string was a bug in the implementation rather than an intended
behavior.  Moreover, a quick check of callers didn't turn up any that
seemed to rely on the strange behavior.

Do you want a re-roll with this verbiage added to the commit messages of
the two relevant commits?

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  reply	other threads:[~2012-09-09  4:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 22:40 [PATCH v2 0/8] Fix some bugs in abspath.c Michael Haggerty
2012-09-06 22:40 ` [PATCH v2 1/8] t0060: move tests of real_path() from t0000 to here Michael Haggerty
2012-09-06 22:40 ` [PATCH v2 2/8] t0060: verify that absolute_path() fails if passed the empty string Michael Haggerty
2012-09-06 22:40 ` [PATCH v2 3/8] absolute_path(): reject " Michael Haggerty
2012-09-06 23:09   ` Junio C Hamano
2012-09-09  4:48     ` Michael Haggerty [this message]
2012-09-09  4:59       ` Junio C Hamano
2012-09-06 22:41 ` [PATCH v2 4/8] t0060: verify that real_path() fails if passed " Michael Haggerty
2012-09-06 22:41 ` [PATCH v2 5/8] real_path(): reject " Michael Haggerty
2012-09-06 22:41 ` [PATCH v2 6/8] t0060: verify that real_path() works correctly with absolute paths Michael Haggerty
2012-09-06 22:41 ` [PATCH v2 7/8] real_path(): properly handle nonexistent top-level paths Michael Haggerty
2012-09-06 22:41 ` [PATCH v2 8/8] t0060: verify that real_path() removes extra slashes Michael Haggerty
2012-09-09 15:42 ` [PATCH 9/8] t0060: split absolute path test in two to exercise some of it on Windows Johannes Sixt
2012-09-10 11:52   ` Michael Haggerty

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

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

  git send-email \
    --in-reply-to=504C1F86.4060608@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=orgads@gmail.com \
    --cc=pclouds@gmail.com \
    /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.
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).