{"thread":{"id":"15608","subject":"clone fails: Could not get the current working directory","startedAt":"2008-09-21T00:49:52Z","lastAt":"2008-09-24T14:43:11Z","messageCount":12,"participants":["John Freeman","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91209","messageId":"48D59A30.5020403@cs.tamu.edu","threadId":"15608","inReplyTo":null,"subject":"clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-21T00:49:52Z","receivedAt":"2008-09-21T00:49:52Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Howdy,\n\nI'm trying to clone a remote repository.  Here's the background:\n\n- The repository is bare, under Bob's home directory on a remote Sun system.\n- Bob has set the group permissions for the repo directory to repogroup.\n- I have an account on the remote system that is in repogroup.\n\nI am trying to clone the repo on my home machine, using\n\n > git clone ssh://john@remote.system.edu/home/bob/path/to/repo\n\nIt fails with\n\nremote: fatal: Could not get the current working directory\nerror: git-upload-pack: git-pack-objects died with error.\nfatal: git-upload-pack: aborting due to possible repository corruption \non the remote side.\nremote: aborting due to possible repository corruption on the remote side.\nfatal: early EOF\nfatal: index-pack failed\n\nChecking the source code, this error is triggered after getcwd() returns \na null pointer in setup.c:set_work_tree(), which is called at only one \nplace, in setup.c:setup_git_directory_gently().\n\nCan anyone provide any insight as to why am I seeing this error?\n\nThank you,\nJohn\n"},{"id":"91272","messageId":"48D6C822.7050602@cs.tamu.edu","threadId":"15608","inReplyTo":"d3a045300809211012l35b1ec2dq39f4174170d8c926@mail.gmail.com","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-21T22:18:10Z","receivedAt":"2008-09-21T22:18:10Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Paul Johnston wrote:\n> On the server, where is git installed? I had a similar problem with\n> clone when my git installation was not in a PATH known to ssh. \nIt is installed in a non-standard directory, /opt/csg/bin.  This is part \nof the system-wide PATH defined in /etc/bashrc.  I also added it to my \n~/.bashrc before I discovered that fact. \n> Try\n> creating symlinks from usr/bin (for example) to your git executables\n> to see if this solves the problem.\nI did create symlinks in $HOME/local/bin which is in the PATH defined in \nmy ~/.bashrc.  I do not have administrator privileges, so I cannot put \nsymlinks in /usr/bin.  I think it is finding the executable just fine, \nbut that there is some issue with accessing the repo directory.  I have \ntested with\n\n > ssh user@remote.system.edu -- \"git-upload-pack\"\n\nand it works as expected.\n>   Also, search the archives for\n> git-upload-pack.\n>   \nI've skimmed it, and I see nothing related to my problem.  Specifying \n--upload-pack explicitly gives the same error.\n\nThank you for the response, though.  Are there any other ideas?\n\n- John\n"},{"id":"91335","messageId":"48D7E4B7.3010109@cs.tamu.edu","threadId":"15608","inReplyTo":"48D6C822.7050602@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-22T18:32:23Z","receivedAt":"2008-09-22T18:32:23Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"I have also tried copying the repo to my home directory on the remote \nSun machine, and then cloning to my local machine.  This works as expected.\n\nDoes anyone know why a call to getcwd() would fail?\n\nI found this in some documentation on getcwd:\nhttp://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html\n\"If a program is operating in a directory where some (grand)parent \ndirectory does not permit reading, getcwd() may fail, as in most \nimplementations it must read the directory to determine the name of the \nfile. This can occur if search, but not read, permission is granted in \nan intermediate directory, or if the program is placed in that directory \nby some more privileged process (for example, login). Including the \n[EACCES] error condition makes the reporting of the error consistent and \nwarns the application writer that getcwd() can fail for reasons beyond \nthe control of the application writer or user. Some implementations can \navoid this occurrence (for example, by implementing getcwd() using pwd, \nwhere pwd is a set-user-root process), thus the error was made optional.\"\n\nDoes anyone know for certain if this is true for Sun machines?  Would it \nbe possible to patch / introduce a macro that changes the use of \ngetcwd() to a use of pwd, like the above documentation suggests?\n\n- John\n"},{"id":"91387","messageId":"81b0412b0809230539x340bd579q3489d5e257b9740@mail.gmail.com","threadId":"15608","inReplyTo":"48D59A30.5020403@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-09-23T12:39:09Z","receivedAt":"2008-09-23T12:39:09Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/9/21 John Freeman <jfreeman@cs.tamu.edu>:\n> - The repository is bare, under Bob's home directory on a remote Sun system.\n> - Bob has set the group permissions for the repo directory to repogroup.\n> - I have an account on the remote system that is in repogroup.\n>\n> I am trying to clone the repo on my home machine, using\n>\n>> git clone ssh://john@remote.system.edu/home/bob/path/to/repo\n>\n> It fails with\n>\n> remote: fatal: Could not get the current working directory\n\nDo these work:\n\n  $ ssh john@remote.system.edu ls -R /home/bob/path/to/repo\n  $ ssh john@remote.system.edu 'cd /home/bob/path/to/repo && pwd'\n\n?\n"},{"id":"91389","messageId":"48D8EDDA.3050804@cs.tamu.edu","threadId":"15608","inReplyTo":"81b0412b0809230539x340bd579q3489d5e257b9740@mail.gmail.com","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-23T13:23:38Z","receivedAt":"2008-09-23T13:23:38Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Alex Riesen wrote:\n> Do these work:\n>   $ ssh john@remote.system.edu ls -R /home/bob/path/to/repo\n>   $ ssh john@remote.system.edu 'cd /home/bob/path/to/repo && pwd'\n>   \n\nYes, they do.  I wish the mailing list did better threading; please see \nmy other posts if you happened to miss them:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/96442\nhttp://article.gmane.org/gmane.comp.version-control.git/96505\n\nThank you,\nJohn\n"},{"id":"91397","messageId":"81b0412b0809230712u4a1cbe0fo69f558cbe9a26aae@mail.gmail.com","threadId":"15608","inReplyTo":"48D8EDDA.3050804@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-09-23T14:12:43Z","receivedAt":"2008-09-23T14:12:43Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/9/23 John Freeman <jfreeman@cs.tamu.edu>:\n> Alex Riesen wrote:\n>>\n>> Do these work:\n>>  $ ssh john@remote.system.edu ls -R /home/bob/path/to/repo\n>>  $ ssh john@remote.system.edu 'cd /home/bob/path/to/repo && pwd'\n>>\n>\n> Yes, they do.  I wish the mailing list did better threading; please see my\n> other posts if you happened to miss them:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/96442\n> http://article.gmane.org/gmane.comp.version-control.git/96505\n>\n\nSaw them. .bashrc (/etc/bashrc too) is not used for non-interactive sessions,\nlike yours (of course, you can source them from\n.profile/.bash_login/.bash_profile).\n\nHave you tried the commands exactly? (Even more interesting would be to try\na simple getpwd program which prints errno)\n"},{"id":"91403","messageId":"48D90125.3090703@cs.tamu.edu","threadId":"15608","inReplyTo":"81b0412b0809230712u4a1cbe0fo69f558cbe9a26aae@mail.gmail.com","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-23T14:45:57Z","receivedAt":"2008-09-23T14:45:57Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Alex Riesen wrote:\n> Saw them. .bashrc (/etc/bashrc too) is not used for non-interactive \n> sessions,\n> like yours (of course, you can source them from\n> .profile/.bash_login/.bash_profile).\n>\n> Have you tried the commands exactly? (Even more interesting would be to try\n> a simple getpwd program which prints errno)\n>   \n\nI have.  I'm convinced that the problem is not missing commands; if it \nwere, I'd be getting a \"missing command,\" or \"file not found,\" or \nsimilar error.  Like I've said, I am able to get this to work when the \nrepo is in my home directory.  It only fails when the repo is on another \npath in the system for which I do not have read privileges all the way \ndown - only at the end.\n\n- John\n"},{"id":"91404","messageId":"81b0412b0809230801l2e6b1a71v1210317fe636aeba@mail.gmail.com","threadId":"15608","inReplyTo":"48D90125.3090703@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-09-23T15:01:08Z","receivedAt":"2008-09-23T15:01:08Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/9/23 John Freeman <jfreeman@cs.tamu.edu>:\n> Alex Riesen wrote:\n>>\n>> Saw them. .bashrc (/etc/bashrc too) is not used for non-interactive\n>> sessions,\n>> like yours (of course, you can source them from\n>> .profile/.bash_login/.bash_profile).\n>>\n>> Have you tried the commands exactly? (Even more interesting would be to\n>> try\n>> a simple getpwd program which prints errno)\n>>\n>\n> I have.  I'm convinced that the problem is not missing commands; if it were,\n> I'd be getting a \"missing command,\" or \"file not found,\" or similar error.\n\nI actually expected \"ls -R\" giving error about unable to read the directory\n(permissions).\n\n>  Like I've said, I am able to get this to work when the repo is in my home\n> directory.  It only fails when the repo is on another path in the system for\n> which I do not have read privileges all the way down - only at the end.\n\nAgain: try a simple program which just does getpwd for this pathname\n"},{"id":"91431","messageId":"48D95C96.4030906@cs.tamu.edu","threadId":"15608","inReplyTo":"81b0412b0809230801l2e6b1a71v1210317fe636aeba@mail.gmail.com","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-23T21:16:06Z","receivedAt":"2008-09-23T21:16:06Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Alex Riesen wrote:\n> I actually expected \"ls -R\" giving error about unable to read the \n> directory (permissions).\n\nThis worked.\n> Again: try a simple program which just does getpwd for this pathname\n\n From what I gather, getpwd() is in libiberty, which I didn't feel like \nmessing with for this example.  I ran a small test program that called \ngetcwd() in the repo directory, and it failed.  errno was set to EACCES, \nindicating insufficient permissions.\n\nhttp://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html\n\nI may get around later to patching this, but for now we're moving ahead \nwith a workaround.\n\n- John\n"},{"id":"91461","messageId":"81b0412b0809240430y682d6dd9wef801c33a6ee2f85@mail.gmail.com","threadId":"15608","inReplyTo":"48D95C96.4030906@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-09-24T11:30:45Z","receivedAt":"2008-09-24T11:30:45Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/9/23 John Freeman <jfreeman@cs.tamu.edu>:\n> Alex Riesen wrote:\n>> Again: try a simple program which just does getpwd for this pathname\n>\n> From what I gather, getpwd() is in libiberty, which I didn't feel like\n> messing with for this example.  I ran a small test program that called\n> getcwd() in the repo directory, and it failed.  errno was set to EACCES,\n> indicating insufficient permissions.\n\nSo there we are...\n\n> http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html\n\nIt suggest a rather dubious workaround (calling pwd).\n\n> I may get around later to patching this, but for now we're moving ahead with\n> a workaround.\n\n...but that's a system-inflicted workaround. We just have to do it or something\nlike what it does.\n\nGeneral question: What does Sun's pwd do?\n"},{"id":"91462","messageId":"48DA410A.2080504@cs.tamu.edu","threadId":"15608","inReplyTo":"81b0412b0809240430y682d6dd9wef801c33a6ee2f85@mail.gmail.com","subject":"Re: clone fails: Could not get the current working directory","fromName":"John Freeman","fromEmail":"jfreeman@cs.tamu.edu","sentAt":"2008-09-24T13:30:50Z","receivedAt":"2008-09-24T13:30:50Z","isPatch":false,"sender":{"key":"jfreeman@cs.tamu.edu","avatar":null},"body":"Alex Riesen wrote:\n> General question: What does Sun's pwd do?\n>   \n\nIt works like you'd expect.  There are no permission problems.  Even in \ndirectories for which I don't have read access, it will show the path.\n\n- John\n"},{"id":"91468","messageId":"81b0412b0809240743l4ef88c51o8aebc496ca16e7c4@mail.gmail.com","threadId":"15608","inReplyTo":"48DA410A.2080504@cs.tamu.edu","subject":"Re: clone fails: Could not get the current working directory","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-09-24T14:43:11Z","receivedAt":"2008-09-24T14:43:11Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/9/24 John Freeman <jfreeman@cs.tamu.edu>:\n> Alex Riesen wrote:\n>>\n>> General question: What does Sun's pwd do?\n>\n> It works like you'd expect.  There are no permission problems.  Even in\n> directories for which I don't have read access, it will show the path.\n\nNo, not what it shows. What does it call? Which syscalls it uses so we\ncan use them also. Or is /bin/pwd root-SUID?\n"}]}