git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* hitting home directory's parent
@ 2009-08-21 20:05 Daniel Convissor
  2009-08-22  4:10 ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Convissor @ 2009-08-21 20:05 UTC (permalink / raw)
  To: Git Mailing List

Hi:

I just installed git in my Cygwin installation for the first time.  The 
git version is 1.6.1.2, which is the latest version they have.  When I 
enter one of the following commands:
    git --help
    git config --global user.name "Daniel Convissor"

I get this error:
    fatal: Cannot change to /home/danielc/..: Permission denied

Though "git --version" executes fine.

I've been using Cygwin for many years and no other program has ever 
produced this issue for me.  For example, svn --help, ls --help, etc work 
just fine.

Why is git venturing into to the home directory's parent directory?  Is 
this a bug?  If not, is this really necessary?

Thanks,

--Dan

PS:  I'm not subscribed to the list.

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

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

* Re: hitting home directory's parent
  2009-08-21 20:05 hitting home directory's parent Daniel Convissor
@ 2009-08-22  4:10 ` Nguyen Thai Ngoc Duy
  2009-08-22 15:05   ` Daniel Convissor
  0 siblings, 1 reply; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-08-22  4:10 UTC (permalink / raw)
  To: Daniel Convissor; +Cc: Git Mailing List

On Sat, Aug 22, 2009 at 3:05 AM, Daniel
Convissor<danielc@analysisandsolutions.com> wrote:
> Hi:
>
> I just installed git in my Cygwin installation for the first time.  The
> git version is 1.6.1.2, which is the latest version they have.  When I
> enter one of the following commands:
>    git --help
>    git config --global user.name "Daniel Convissor"
>
> I get this error:
>    fatal: Cannot change to /home/danielc/..: Permission denied
>
> Though "git --version" executes fine.
>
> I've been using Cygwin for many years and no other program has ever
> produced this issue for me.  For example, svn --help, ls --help, etc work
> just fine.
>
> Why is git venturing into to the home directory's parent directory?  Is
> this a bug?  If not, is this really necessary?

I guess it tried to find .git directory upward. I think you can set
GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from
git.txt

-'GIT_CEILING_DIRECTORIES'::
        This should be a colon-separated list of absolute paths.
        If set, it is a list of directories that git should not chdir
        up into while looking for a repository directory.
        It will not exclude the current working directory or
        a GIT_DIR set on the command line or in the environment.
        (Useful for excluding slow-loading network directories.)
-
Duy

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

* Re: hitting home directory's parent
  2009-08-22  4:10 ` Nguyen Thai Ngoc Duy
@ 2009-08-22 15:05   ` Daniel Convissor
  2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Convissor @ 2009-08-22 15:05 UTC (permalink / raw)
  To: Git Mailing List

Hi Duy:

On Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:
> 
> I guess it tried to find .git directory upward. I think you can set
> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from
> git.txt

That didn't change the situation.

I did read a bit farther in the manual and initialized a new repository.  
Issuing "git --help" once inside that new repository works.  Requiring 
the --help command to be called from inside a repository, or even that 
it's looking for a repository at all, seems unwise.  All it should do is 
display the usage information and exit.

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

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

* Re: hitting home directory's parent
  2009-08-22 15:05   ` Daniel Convissor
@ 2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
  2009-08-22 16:22       ` Nguyen Thai Ngoc Duy
                         ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-08-22 16:20 UTC (permalink / raw)
  To: Daniel Convissor; +Cc: Git Mailing List

On Sat, Aug 22, 2009 at 10:05 PM, Daniel
Convissor<danielc@analysisandsolutions.com> wrote:
> Hi Duy:
>
> On Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:
>>
>> I guess it tried to find .git directory upward. I think you can set
>> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from
>> git.txt
>
> That didn't change the situation.

I'd suggest you to degrade Git to a version earlier than 1.6.1, when
the error was not added. :-D

But did it at least change the error message? Here is what I got when
"chmod 000 /tmp/a":

/tmp/a/b/c $ cd ../..
bash: cd: ../..: Permission denied
/tmp/a/b/c $ git --help
fatal: Cannot change to '/tmp/a/b/c/..': Permission denied
/tmp/a/b/c $ GIT_CEILING_DIRECTORIES=/tmp/a/b git --help
fatal: Cannot come back to cwd: Permission denied

Looks like absolute path will cause troubles anyway this case.

> I did read a bit farther in the manual and initialized a new repository.
> Issuing "git --help" once inside that new repository works.  Requiring
> the --help command to be called from inside a repository, or even that
> it's looking for a repository at all, seems unwise.  All it should do is
> display the usage information and exit.

For simple things like --help, I agree Git should not do extra work
such as searching for Git repository, which is the cause. That was on
Jeff's plan IIRC.
-- 
Duy

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

* Re: hitting home directory's parent
  2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
@ 2009-08-22 16:22       ` Nguyen Thai Ngoc Duy
  2009-08-22 18:16       ` Jeff King
  2009-08-23  4:42       ` Daniel Convissor
  2 siblings, 0 replies; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-08-22 16:22 UTC (permalink / raw)
  To: Daniel Convissor; +Cc: Git Mailing List

On Sat, Aug 22, 2009 at 11:20 PM, Nguyen Thai Ngoc Duy<pclouds@gmail.com> wrote:
> But did it at least change the error message? Here is what I got when
> "chmod 000 /tmp/a":
>
> /tmp/a/b/c $ cd ../..
> bash: cd: ../..: Permission denied
> /tmp/a/b/c $ git --help
> fatal: Cannot change to '/tmp/a/b/c/..': Permission denied
> /tmp/a/b/c $ GIT_CEILING_DIRECTORIES=/tmp/a/b git --help
> fatal: Cannot come back to cwd: Permission denied

Note: I tested it on Linux, not Cygwin so the behavior may differ.
-- 
Duy

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

* Re: hitting home directory's parent
  2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
  2009-08-22 16:22       ` Nguyen Thai Ngoc Duy
@ 2009-08-22 18:16       ` Jeff King
  2009-08-23  4:07         ` Nguyen Thai Ngoc Duy
  2009-08-23  5:12         ` Daniel Convissor
  2009-08-23  4:42       ` Daniel Convissor
  2 siblings, 2 replies; 11+ messages in thread
From: Jeff King @ 2009-08-22 18:16 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Daniel Convissor, Git Mailing List

On Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:

> > I did read a bit farther in the manual and initialized a new repository.
> > Issuing "git --help" once inside that new repository works.  Requiring
> > the --help command to be called from inside a repository, or even that
> > it's looking for a repository at all, seems unwise.  All it should do is
> > display the usage information and exit.
> 
> For simple things like --help, I agree Git should not do extra work
> such as searching for Git repository, which is the cause. That was on
> Jeff's plan IIRC.

Without looking, I would not be surprised if it is a side effect of
git trying to look up help-related config. So I don't think it is a
problem exactly that it checks to see if it is in a repo (which would
impact config lookup), but that inability to find a repo is a hard
error.

Probably it is calling "setup_git_directory_gently" and ignoring an
error return, but there is a die() inside that function. The bug
then is that the _gently form is calling die().

As for fixing the setup code, I am sadly way behind on my git queue and
not likely to catch up to this anytime soon. So if anybody feels like
taking a stab at it, that would be very welcome.

-Peff

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

* Re: hitting home directory's parent
  2009-08-22 18:16       ` Jeff King
@ 2009-08-23  4:07         ` Nguyen Thai Ngoc Duy
  2009-08-25  4:42           ` Jeff King
  2009-08-23  5:12         ` Daniel Convissor
  1 sibling, 1 reply; 11+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-08-23  4:07 UTC (permalink / raw)
  To: Jeff King; +Cc: Daniel Convissor, Git Mailing List

On Sun, Aug 23, 2009 at 1:16 AM, Jeff King<peff@peff.net> wrote:
> On Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:
>
>> > I did read a bit farther in the manual and initialized a new repository.
>> > Issuing "git --help" once inside that new repository works.  Requiring
>> > the --help command to be called from inside a repository, or even that
>> > it's looking for a repository at all, seems unwise.  All it should do is
>> > display the usage information and exit.
>>
>> For simple things like --help, I agree Git should not do extra work
>> such as searching for Git repository, which is the cause. That was on
>> Jeff's plan IIRC.
>
> Without looking, I would not be surprised if it is a side effect of
> git trying to look up help-related config. So I don't think it is a
> problem exactly that it checks to see if it is in a repo (which would
> impact config lookup), but that inability to find a repo is a hard
> error.
>
> Probably it is calling "setup_git_directory_gently" and ignoring an
> error return, but there is a die() inside that function. The bug
> then is that the _gently form is calling die().

It is (and should be worked around with GIT_CEILING_DIRECTORIES).
Unfortunately in my test, it could not chdir() back when it failed to
find gitdir. chdir() was called with an absolute directory, and one
directory in that path was inaccesible, leading another die("Cannot
come back to cwd"). This one is fatal and should not be ignored. I
don't know whether having an inaccesible parent directory is a real
scenario, as lots of tools would break.
-- 
Duy

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

* Re: hitting home directory's parent
  2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
  2009-08-22 16:22       ` Nguyen Thai Ngoc Duy
  2009-08-22 18:16       ` Jeff King
@ 2009-08-23  4:42       ` Daniel Convissor
  2 siblings, 0 replies; 11+ messages in thread
From: Daniel Convissor @ 2009-08-23  4:42 UTC (permalink / raw)
  To: Git Mailing List

Hi Duy:

On Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:
> On Sat, Aug 22, 2009 at 10:05 PM, Daniel
> Convissor<danielc@analysisandsolutions.com> wrote:
> > Hi Duy:
> >
> > On Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:
> >>
> >> I guess it tried to find .git directory upward. I think you can set
> >> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from
> >> git.txt
> >
> > That didn't change the situation.
> 
> I'd suggest you to degrade Git to a version earlier than 1.6.1, when
> the error was not added. :-D

:)  Might be easier to use "svn ci" instead. :)


> But did it at least change the error message? Here is what I got when
> "chmod 000 /tmp/a":

No.  It produced the same exact error message:
    fatal: Cannot change to /home/danielc/..: Permission denied

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

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

* Re: hitting home directory's parent
  2009-08-22 18:16       ` Jeff King
  2009-08-23  4:07         ` Nguyen Thai Ngoc Duy
@ 2009-08-23  5:12         ` Daniel Convissor
  2009-08-25  4:48           ` Jeff King
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Convissor @ 2009-08-23  5:12 UTC (permalink / raw)
  To: Git Mailing List

Hi Jeff:

On Sat, Aug 22, 2009 at 02:16:07PM -0400, Jeff King wrote:
> 
> Without looking, I would not be surprised if it is a side effect of
> git trying to look up help-related config.

That explains what's happening.  cmd_help() calls git_config().  Though 
it seems it would be more, uh, helpful, if help produced basic usage 
output no matter what, and then produce the more detailed config based 
output if possible.


> Probably it is calling "setup_git_directory_gently" and ignoring an
> error return, but there is a die() inside that function. The bug
> then is that the _gently form is calling die().

Yep.  setup.c, lines 391 and 392 (master branch):
		if (chdir(".."))
			die_errno("Cannot change to '%s/..'", cwd);


> As for fixing the setup code, I am sadly way behind on my git queue and
> not likely to catch up to this anytime soon. So if anybody feels like
> taking a stab at it, that would be very welcome.

Is there a bug tracker y'all use where I can enter a ticket?

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

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

* Re: hitting home directory's parent
  2009-08-23  4:07         ` Nguyen Thai Ngoc Duy
@ 2009-08-25  4:42           ` Jeff King
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff King @ 2009-08-25  4:42 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Daniel Convissor, Git Mailing List

On Sun, Aug 23, 2009 at 11:07:39AM +0700, Nguyen Thai Ngoc Duy wrote:

> It is (and should be worked around with GIT_CEILING_DIRECTORIES).
> Unfortunately in my test, it could not chdir() back when it failed to
> find gitdir. chdir() was called with an absolute directory, and one
> directory in that path was inaccesible, leading another die("Cannot
> come back to cwd"). This one is fatal and should not be ignored. I
> don't know whether having an inaccesible parent directory is a real
> scenario, as lots of tools would break.

Hmm, good point. Some of those die()s really can't be removed, because
we have munged state in a way that can't be recovered (or is hard to
recover).

Also, thinking about it a bit more, I'm not sure it is correct to turn
such a die() into a "return -1" without passing more information along
to the caller. Because there are really three possible outcomes:

  1. we are in a git repo
  2. we are not in a git repo
  3. some error occurred and we could not determine which
     of (1) and (2) is the case

And the "gently" bit really just refers to (1) versus (2). It is
tempting to fold (3) into (2), but I'm not sure that is the right thing
to do; some callers (including script callers not under our control) may
care about the distinction (though I think we already blur it; for
example, a non-existent '.git' regular file is treated the same as one
which we couldn't stat for permission problems).

So perhaps the right thing is to either pass back a tri-state status, or
to have an extra_gently mode, either of which could be used by "git
help".  The problem with either is that the current setup process is not
amenable to exiting in the middle -- it really may leave us in a weird
and buggy state due to the chdir.

So short of major surgery on the setup procedure, I think we may have to
leave this bug be for now (especially because I'm not convinced the
setup of a non-executable parent directory isn't a little bit crazy).

-Peff

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

* Re: hitting home directory's parent
  2009-08-23  5:12         ` Daniel Convissor
@ 2009-08-25  4:48           ` Jeff King
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff King @ 2009-08-25  4:48 UTC (permalink / raw)
  To: Daniel Convissor; +Cc: Git Mailing List

On Sun, Aug 23, 2009 at 01:12:44AM -0400, Daniel Convissor wrote:

> That explains what's happening.  cmd_help() calls git_config().  Though 
> it seems it would be more, uh, helpful, if help produced basic usage 
> output no matter what, and then produce the more detailed config based 
> output if possible.

I agree, but the way the code is structured right now means doing this
right is probably a pretty big change (see my other message to Duy). So
I think it will probably go unfixed for the time being.

> Is there a bug tracker y'all use where I can enter a ticket?

We don't have a formal bug tracker, but this is really just a sub-part
of another issue, so it will get addressed when the parent issue is
fixed.

-Peff

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

end of thread, other threads:[~2009-08-25  4:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-21 20:05 hitting home directory's parent Daniel Convissor
2009-08-22  4:10 ` Nguyen Thai Ngoc Duy
2009-08-22 15:05   ` Daniel Convissor
2009-08-22 16:20     ` Nguyen Thai Ngoc Duy
2009-08-22 16:22       ` Nguyen Thai Ngoc Duy
2009-08-22 18:16       ` Jeff King
2009-08-23  4:07         ` Nguyen Thai Ngoc Duy
2009-08-25  4:42           ` Jeff King
2009-08-23  5:12         ` Daniel Convissor
2009-08-25  4:48           ` Jeff King
2009-08-23  4:42       ` Daniel Convissor

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).