{"thread":{"id":"20690","subject":"hitting home directory's parent","startedAt":"2009-08-21T20:05:04Z","lastAt":"2009-08-25T04:48:18Z","messageCount":11,"participants":["Daniel Convissor","Nguyen Thai Ngoc Duy","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"121456","messageId":"20090821200503.GA19660@panix.com","threadId":"20690","inReplyTo":null,"subject":"hitting home directory's parent","fromName":"Daniel Convissor","fromEmail":"danielc@analysisandsolutions.com","sentAt":"2009-08-21T20:05:04Z","receivedAt":"2009-08-21T20:05:04Z","isPatch":false,"sender":{"key":"danielc@analysisandsolutions.com","avatar":"https://gravatar.com/avatar/6934d176616faccef0fe2329329c24e2a2d92783d565704c7c4f85ea9219d412?d=mp&s=160"},"body":"Hi:\n\nI just installed git in my Cygwin installation for the first time.  The \ngit version is 1.6.1.2, which is the latest version they have.  When I \nenter one of the following commands:\n    git --help\n    git config --global user.name \"Daniel Convissor\"\n\nI get this error:\n    fatal: Cannot change to /home/danielc/..: Permission denied\n\nThough \"git --version\" executes fine.\n\nI've been using Cygwin for many years and no other program has ever \nproduced this issue for me.  For example, svn --help, ls --help, etc work \njust fine.\n\nWhy is git venturing into to the home directory's parent directory?  Is \nthis a bug?  If not, is this really necessary?\n\nThanks,\n\n--Dan\n\nPS:  I'm not subscribed to the list.\n\n-- \n 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\n            data intensive web and database programming\n                http://www.AnalysisAndSolutions.com/\n 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409\n"},{"id":"121488","messageId":"fcaeb9bf0908212110o5ed1233ek11183fa37b474a06@mail.gmail.com","threadId":"20690","inReplyTo":"20090821200503.GA19660@panix.com","subject":"Re: hitting home directory's parent","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-08-22T04:10:18Z","receivedAt":"2009-08-22T04:10:18Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Aug 22, 2009 at 3:05 AM, Daniel\nConvissor<danielc@analysisandsolutions.com> wrote:\n> Hi:\n>\n> I just installed git in my Cygwin installation for the first time.  The\n> git version is 1.6.1.2, which is the latest version they have.  When I\n> enter one of the following commands:\n>    git --help\n>    git config --global user.name \"Daniel Convissor\"\n>\n> I get this error:\n>    fatal: Cannot change to /home/danielc/..: Permission denied\n>\n> Though \"git --version\" executes fine.\n>\n> I've been using Cygwin for many years and no other program has ever\n> produced this issue for me.  For example, svn --help, ls --help, etc work\n> just fine.\n>\n> Why is git venturing into to the home directory's parent directory?  Is\n> this a bug?  If not, is this really necessary?\n\nI guess it tried to find .git directory upward. I think you can set\nGIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from\ngit.txt\n\n-'GIT_CEILING_DIRECTORIES'::\n        This should be a colon-separated list of absolute paths.\n        If set, it is a list of directories that git should not chdir\n        up into while looking for a repository directory.\n        It will not exclude the current working directory or\n        a GIT_DIR set on the command line or in the environment.\n        (Useful for excluding slow-loading network directories.)\n-\nDuy\n"},{"id":"121518","messageId":"20090822150542.GA29507@panix.com","threadId":"20690","inReplyTo":"fcaeb9bf0908212110o5ed1233ek11183fa37b474a06@mail.gmail.com","subject":"Re: hitting home directory's parent","fromName":"Daniel Convissor","fromEmail":"danielc@analysisandsolutions.com","sentAt":"2009-08-22T15:05:43Z","receivedAt":"2009-08-22T15:05:43Z","isPatch":false,"sender":{"key":"danielc@analysisandsolutions.com","avatar":"https://gravatar.com/avatar/6934d176616faccef0fe2329329c24e2a2d92783d565704c7c4f85ea9219d412?d=mp&s=160"},"body":"Hi Duy:\n\nOn Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:\n> \n> I guess it tried to find .git directory upward. I think you can set\n> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from\n> git.txt\n\nThat didn't change the situation.\n\nI did read a bit farther in the manual and initialized a new repository.  \nIssuing \"git --help\" once inside that new repository works.  Requiring \nthe --help command to be called from inside a repository, or even that \nit's looking for a repository at all, seems unwise.  All it should do is \ndisplay the usage information and exit.\n\nThanks,\n\n--Dan\n\n-- \n 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\n            data intensive web and database programming\n                http://www.AnalysisAndSolutions.com/\n 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409\n"},{"id":"121519","messageId":"fcaeb9bf0908220920g29ec24e9v23d0504d10ca6cfb@mail.gmail.com","threadId":"20690","inReplyTo":"20090822150542.GA29507@panix.com","subject":"Re: hitting home directory's parent","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-08-22T16:20:39Z","receivedAt":"2009-08-22T16:20:39Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Aug 22, 2009 at 10:05 PM, Daniel\nConvissor<danielc@analysisandsolutions.com> wrote:\n> Hi Duy:\n>\n> On Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:\n>>\n>> I guess it tried to find .git directory upward. I think you can set\n>> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from\n>> git.txt\n>\n> That didn't change the situation.\n\nI'd suggest you to degrade Git to a version earlier than 1.6.1, when\nthe error was not added. :-D\n\nBut did it at least change the error message? Here is what I got when\n\"chmod 000 /tmp/a\":\n\n/tmp/a/b/c $ cd ../..\nbash: cd: ../..: Permission denied\n/tmp/a/b/c $ git --help\nfatal: Cannot change to '/tmp/a/b/c/..': Permission denied\n/tmp/a/b/c $ GIT_CEILING_DIRECTORIES=/tmp/a/b git --help\nfatal: Cannot come back to cwd: Permission denied\n\nLooks like absolute path will cause troubles anyway this case.\n\n> I did read a bit farther in the manual and initialized a new repository.\n> Issuing \"git --help\" once inside that new repository works.  Requiring\n> the --help command to be called from inside a repository, or even that\n> it's looking for a repository at all, seems unwise.  All it should do is\n> display the usage information and exit.\n\nFor simple things like --help, I agree Git should not do extra work\nsuch as searching for Git repository, which is the cause. That was on\nJeff's plan IIRC.\n-- \nDuy\n"},{"id":"121520","messageId":"fcaeb9bf0908220922g7cba54d8jd1af36e89c516a5@mail.gmail.com","threadId":"20690","inReplyTo":"fcaeb9bf0908220920g29ec24e9v23d0504d10ca6cfb@mail.gmail.com","subject":"Re: hitting home directory's parent","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-08-22T16:22:36Z","receivedAt":"2009-08-22T16:22:36Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Aug 22, 2009 at 11:20 PM, Nguyen Thai Ngoc Duy<pclouds@gmail.com> wrote:\n> But did it at least change the error message? Here is what I got when\n> \"chmod 000 /tmp/a\":\n>\n> /tmp/a/b/c $ cd ../..\n> bash: cd: ../..: Permission denied\n> /tmp/a/b/c $ git --help\n> fatal: Cannot change to '/tmp/a/b/c/..': Permission denied\n> /tmp/a/b/c $ GIT_CEILING_DIRECTORIES=/tmp/a/b git --help\n> fatal: Cannot come back to cwd: Permission denied\n\nNote: I tested it on Linux, not Cygwin so the behavior may differ.\n-- \nDuy\n"},{"id":"121521","messageId":"20090822181607.GA25823@coredump.intra.peff.net","threadId":"20690","inReplyTo":"fcaeb9bf0908220920g29ec24e9v23d0504d10ca6cfb@mail.gmail.com","subject":"Re: hitting home directory's parent","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-22T18:16:07Z","receivedAt":"2009-08-22T18:16:07Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:\n\n> > I did read a bit farther in the manual and initialized a new repository.\n> > Issuing \"git --help\" once inside that new repository works.  Requiring\n> > the --help command to be called from inside a repository, or even that\n> > it's looking for a repository at all, seems unwise.  All it should do is\n> > display the usage information and exit.\n> \n> For simple things like --help, I agree Git should not do extra work\n> such as searching for Git repository, which is the cause. That was on\n> Jeff's plan IIRC.\n\nWithout looking, I would not be surprised if it is a side effect of\ngit trying to look up help-related config. So I don't think it is a\nproblem exactly that it checks to see if it is in a repo (which would\nimpact config lookup), but that inability to find a repo is a hard\nerror.\n\nProbably it is calling \"setup_git_directory_gently\" and ignoring an\nerror return, but there is a die() inside that function. The bug\nthen is that the _gently form is calling die().\n\nAs for fixing the setup code, I am sadly way behind on my git queue and\nnot likely to catch up to this anytime soon. So if anybody feels like\ntaking a stab at it, that would be very welcome.\n\n-Peff\n"},{"id":"121546","messageId":"fcaeb9bf0908222107i6d999335r998a304aaa3cd405@mail.gmail.com","threadId":"20690","inReplyTo":"20090822181607.GA25823@coredump.intra.peff.net","subject":"Re: hitting home directory's parent","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-08-23T04:07:39Z","receivedAt":"2009-08-23T04:07:39Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Aug 23, 2009 at 1:16 AM, Jeff King<peff@peff.net> wrote:\n> On Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:\n>\n>> > I did read a bit farther in the manual and initialized a new repository.\n>> > Issuing \"git --help\" once inside that new repository works.  Requiring\n>> > the --help command to be called from inside a repository, or even that\n>> > it's looking for a repository at all, seems unwise.  All it should do is\n>> > display the usage information and exit.\n>>\n>> For simple things like --help, I agree Git should not do extra work\n>> such as searching for Git repository, which is the cause. That was on\n>> Jeff's plan IIRC.\n>\n> Without looking, I would not be surprised if it is a side effect of\n> git trying to look up help-related config. So I don't think it is a\n> problem exactly that it checks to see if it is in a repo (which would\n> impact config lookup), but that inability to find a repo is a hard\n> error.\n>\n> Probably it is calling \"setup_git_directory_gently\" and ignoring an\n> error return, but there is a die() inside that function. The bug\n> then is that the _gently form is calling die().\n\nIt is (and should be worked around with GIT_CEILING_DIRECTORIES).\nUnfortunately in my test, it could not chdir() back when it failed to\nfind gitdir. chdir() was called with an absolute directory, and one\ndirectory in that path was inaccesible, leading another die(\"Cannot\ncome back to cwd\"). This one is fatal and should not be ignored. I\ndon't know whether having an inaccesible parent directory is a real\nscenario, as lots of tools would break.\n-- \nDuy\n"},{"id":"121549","messageId":"20090823044202.GA10761@panix.com","threadId":"20690","inReplyTo":"fcaeb9bf0908220920g29ec24e9v23d0504d10ca6cfb@mail.gmail.com","subject":"Re: hitting home directory's parent","fromName":"Daniel Convissor","fromEmail":"danielc@analysisandsolutions.com","sentAt":"2009-08-23T04:42:02Z","receivedAt":"2009-08-23T04:42:02Z","isPatch":false,"sender":{"key":"danielc@analysisandsolutions.com","avatar":"https://gravatar.com/avatar/6934d176616faccef0fe2329329c24e2a2d92783d565704c7c4f85ea9219d412?d=mp&s=160"},"body":"Hi Duy:\n\nOn Sat, Aug 22, 2009 at 11:20:39PM +0700, Nguyen Thai Ngoc Duy wrote:\n> On Sat, Aug 22, 2009 at 10:05 PM, Daniel\n> Convissor<danielc@analysisandsolutions.com> wrote:\n> > Hi Duy:\n> >\n> > On Sat, Aug 22, 2009 at 11:10:18AM +0700, Nguyen Thai Ngoc Duy wrote:\n> >>\n> >> I guess it tried to find .git directory upward. I think you can set\n> >> GIT_CEILING_DIRECTORIES to make it stop at /home/danielc. Excerpt from\n> >> git.txt\n> >\n> > That didn't change the situation.\n> \n> I'd suggest you to degrade Git to a version earlier than 1.6.1, when\n> the error was not added. :-D\n\n:)  Might be easier to use \"svn ci\" instead. :)\n\n\n> But did it at least change the error message? Here is what I got when\n> \"chmod 000 /tmp/a\":\n\nNo.  It produced the same exact error message:\n    fatal: Cannot change to /home/danielc/..: Permission denied\n\nThanks,\n\n--Dan\n\n-- \n 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\n            data intensive web and database programming\n                http://www.AnalysisAndSolutions.com/\n 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409\n"},{"id":"121550","messageId":"20090823051244.GB10761@panix.com","threadId":"20690","inReplyTo":"20090822181607.GA25823@coredump.intra.peff.net","subject":"Re: hitting home directory's parent","fromName":"Daniel Convissor","fromEmail":"danielc@analysisandsolutions.com","sentAt":"2009-08-23T05:12:44Z","receivedAt":"2009-08-23T05:12:44Z","isPatch":false,"sender":{"key":"danielc@analysisandsolutions.com","avatar":"https://gravatar.com/avatar/6934d176616faccef0fe2329329c24e2a2d92783d565704c7c4f85ea9219d412?d=mp&s=160"},"body":"Hi Jeff:\n\nOn Sat, Aug 22, 2009 at 02:16:07PM -0400, Jeff King wrote:\n> \n> Without looking, I would not be surprised if it is a side effect of\n> git trying to look up help-related config.\n\nThat explains what's happening.  cmd_help() calls git_config().  Though \nit seems it would be more, uh, helpful, if help produced basic usage \noutput no matter what, and then produce the more detailed config based \noutput if possible.\n\n\n> Probably it is calling \"setup_git_directory_gently\" and ignoring an\n> error return, but there is a die() inside that function. The bug\n> then is that the _gently form is calling die().\n\nYep.  setup.c, lines 391 and 392 (master branch):\n\t\tif (chdir(\"..\"))\n\t\t\tdie_errno(\"Cannot change to '%s/..'\", cwd);\n\n\n> As for fixing the setup code, I am sadly way behind on my git queue and\n> not likely to catch up to this anytime soon. So if anybody feels like\n> taking a stab at it, that would be very welcome.\n\nIs there a bug tracker y'all use where I can enter a ticket?\n\nThanks,\n\n--Dan\n\n-- \n 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\n            data intensive web and database programming\n                http://www.AnalysisAndSolutions.com/\n 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409\n"},{"id":"121701","messageId":"20090825044236.GA13738@coredump.intra.peff.net","threadId":"20690","inReplyTo":"fcaeb9bf0908222107i6d999335r998a304aaa3cd405@mail.gmail.com","subject":"Re: hitting home directory's parent","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-25T04:42:36Z","receivedAt":"2009-08-25T04:42:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Aug 23, 2009 at 11:07:39AM +0700, Nguyen Thai Ngoc Duy wrote:\n\n> It is (and should be worked around with GIT_CEILING_DIRECTORIES).\n> Unfortunately in my test, it could not chdir() back when it failed to\n> find gitdir. chdir() was called with an absolute directory, and one\n> directory in that path was inaccesible, leading another die(\"Cannot\n> come back to cwd\"). This one is fatal and should not be ignored. I\n> don't know whether having an inaccesible parent directory is a real\n> scenario, as lots of tools would break.\n\nHmm, good point. Some of those die()s really can't be removed, because\nwe have munged state in a way that can't be recovered (or is hard to\nrecover).\n\nAlso, thinking about it a bit more, I'm not sure it is correct to turn\nsuch a die() into a \"return -1\" without passing more information along\nto the caller. Because there are really three possible outcomes:\n\n  1. we are in a git repo\n  2. we are not in a git repo\n  3. some error occurred and we could not determine which\n     of (1) and (2) is the case\n\nAnd the \"gently\" bit really just refers to (1) versus (2). It is\ntempting to fold (3) into (2), but I'm not sure that is the right thing\nto do; some callers (including script callers not under our control) may\ncare about the distinction (though I think we already blur it; for\nexample, a non-existent '.git' regular file is treated the same as one\nwhich we couldn't stat for permission problems).\n\nSo perhaps the right thing is to either pass back a tri-state status, or\nto have an extra_gently mode, either of which could be used by \"git\nhelp\".  The problem with either is that the current setup process is not\namenable to exiting in the middle -- it really may leave us in a weird\nand buggy state due to the chdir.\n\nSo short of major surgery on the setup procedure, I think we may have to\nleave this bug be for now (especially because I'm not convinced the\nsetup of a non-executable parent directory isn't a little bit crazy).\n\n-Peff\n"},{"id":"121703","messageId":"20090825044818.GB13738@coredump.intra.peff.net","threadId":"20690","inReplyTo":"20090823051244.GB10761@panix.com","subject":"Re: hitting home directory's parent","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-25T04:48:18Z","receivedAt":"2009-08-25T04:48:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Aug 23, 2009 at 01:12:44AM -0400, Daniel Convissor wrote:\n\n> That explains what's happening.  cmd_help() calls git_config().  Though \n> it seems it would be more, uh, helpful, if help produced basic usage \n> output no matter what, and then produce the more detailed config based \n> output if possible.\n\nI agree, but the way the code is structured right now means doing this\nright is probably a pretty big change (see my other message to Duy). So\nI think it will probably go unfixed for the time being.\n\n> Is there a bug tracker y'all use where I can enter a ticket?\n\nWe don't have a formal bug tracker, but this is really just a sub-part\nof another issue, so it will get addressed when the parent issue is\nfixed.\n\n-Peff\n"}]}