Git development
 help / color / mirror / Atom feed
From: Francis Galiegue <fg@one2team.net>
To: Andreas Ericsson <ae@op5.se>
Cc: Junio C Hamano <gitster@pobox.com>, Sam Vilain <sam@vilain.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] sha1_file: make sure correct error is propagated
Date: Fri, 14 Nov 2008 21:08:46 +0100	[thread overview]
Message-ID: <200811142108.46762.fg@one2team.net> (raw)
In-Reply-To: <491DD671.8070801@op5.se>

Le Friday 14 November 2008 20:50:09 Andreas Ericsson, vous avez écrit :
> Francis Galiegue wrote:
> > Le Friday 14 November 2008 20:05:19 Junio C Hamano, vous avez écrit :
> > [...]
> >
> >>>  	fd = mkstemp(buffer);
> >>> -	if (fd < 0 && dirlen && (errno != EPERM)) {
> >>> +	if (fd < 0 && dirlen && (errno != EACCESS)) {
> >>
> >> Is this accepting the two as equivalents???
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe git" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> > Well, looking at mkdir(2), it says:
> >
> >        EPERM  The file system containing pathname does not support the
> > creation of directories.
> >
> > Hmm, err... git would fail at an earlier point anyway, wouldn't it? Even
> > git init would fail there.
>
> Not necessarily. .git could be mounted erroneously from via a networked
> filesystem but without write permissions. 

In which case EACCESS would be returned anyway. There is quite a difference 
between EACCESS (Permission denied) and EPERM (operation not permitted).

Basically, my understanding is that mkdir() will only return EPERM if the 
underlying filesystem can not even CREATE directories on the filesystem. So, 
unless you are doing very bizarre things with your git repository, I cannot 
see how you can even trigger an EPERM unless you asked for it.

> Yes, other things would fail 
> then too, but both EPERM and EACCESS are valid and possible return codes.

And so is ENOSPC, and so is EIO, and so is... It's endless. I think focus 
should be made on the most common ones, and EACCESS _is_ such one. Others 
just aren't.

This is why I suggested replacing EPERM with EACCESS in the first place: 
EACCESS is by far the most common error code you will get (even root will get 
that on a read-only filesystem, not EPERM).

-- 
fge

  reply	other threads:[~2008-11-14 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14  7:19 [PATCH] sha1_file: make sure correct error is propagated Sam Vilain
2008-11-14  7:44 ` Francis Galiegue
2008-11-14  9:41   ` Sam Vilain
2008-11-14 19:05     ` Junio C Hamano
2008-11-14 19:09       ` Francis Galiegue
2008-11-14 19:50         ` Andreas Ericsson
2008-11-14 20:08           ` Francis Galiegue [this message]
2008-11-15  5:44         ` Junio C Hamano
2008-11-15  6:30           ` Sam Vilain

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=200811142108.46762.fg@one2team.net \
    --to=fg@one2team.net \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sam@vilain.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox