git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Zenobiusz Kunegunda <zenobiusz.kunegunda@interia.pl>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: fatal: Could not get current working directory: Permission denied | affected 2.10,2.11,2.12, but not 1.9.5 |
Date: Fri, 17 Mar 2017 20:34:46 +0100	[thread overview]
Message-ID: <f6588ace-eecc-118d-ef26-70bc21dcc4d4@web.de> (raw)
In-Reply-To: <7f25def4-9943-ae59-a649-b4348a79890e@web.de>

Am 15.03.2017 um 22:30 schrieb René Scharfe:
> Am 15.03.2017 um 10:44 schrieb Zenobiusz Kunegunda:
>> $ git bisect bad
>> 7333ed1788b4f2b162a35003044d77a716732a1f is the first bad commit
>> commit 7333ed1788b4f2b162a35003044d77a716732a1f
>> Author: René Scharfe <l.s.r@web.de>
>> Date:   Mon Jul 28 20:26:40 2014 +0200
>>
>>     setup: convert setup_git_directory_gently_1 et al. to strbuf
> 
> That's what I half-suspected, and I think by now I got an idea.  Here's
> a test program:

And here's a patch for letting strbuf_getcwd() use the same getcwd(3)
extension that pwd(1) uses.  It avoids the need to guess the path's
length and thus reduces the chance of stumbling over strange error
codes.  I wonder if it helps in your case.

René

---
 strbuf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/strbuf.c b/strbuf.c
index ace58e7367..4c02801edd 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -442,6 +442,14 @@ int strbuf_getcwd(struct strbuf *sb)
 {
 	size_t oldalloc = sb->alloc;
 	size_t guessed_len = 128;
+	char *cwd;
+
+	cwd = getcwd(NULL, 0);
+	if (cwd) {
+		size_t len = strlen(cwd);
+		strbuf_attach(sb, cwd, len, len + 1);
+		return 0;
+	}
 
 	for (;; guessed_len *= 2) {
 		strbuf_grow(sb, guessed_len);
-- 
2.12.0

  reply	other threads:[~2017-03-17 19:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 16:10 fatal: Could not get current working directory: Permission denied | affected 2.10,2.11,2.12, but not 1.9.5 | Zenobiusz Kunegunda
2017-03-08 17:36 ` René Scharfe
2017-03-09 11:01   ` Zenobiusz Kunegunda
2017-03-11 21:17     ` René Scharfe
2017-03-13 12:23       ` Zenobiusz Kunegunda
2017-03-13 17:31         ` René Scharfe
2017-03-14 15:25           ` Zenobiusz Kunegunda
2017-03-13 13:23       ` Zenobiusz Kunegunda
2017-03-13 21:31         ` René Scharfe
2017-03-14  7:44           ` Zenobiusz Kunegunda
2017-03-14 17:59             ` René Scharfe
2017-03-15  9:44               ` Zenobiusz Kunegunda
2017-03-15 21:30                 ` René Scharfe
2017-03-17 19:34                   ` René Scharfe [this message]
2017-03-17 19:45                     ` Stefan Beller
2017-03-17 21:07                       ` René Scharfe
2017-03-17 22:29                         ` Jeff King
2017-03-17 22:50                           ` René Scharfe
2017-03-21 13:29                         ` Zenobiusz Kunegunda
2017-03-21 19:04                           ` René Scharfe
2017-03-22  8:30                             ` Zenobiusz Kunegunda
2017-03-21 10:08                   ` Zenobiusz Kunegunda
2017-03-09 11:11   ` Zenobiusz Kunegunda

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=f6588ace-eecc-118d-ef26-70bc21dcc4d4@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=zenobiusz.kunegunda@interia.pl \
    /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).