{"thread":{"id":"37176","subject":"[PATCH 0/3] getcwd without PATH_MAX","startedAt":"2014-07-20T11:18:52Z","lastAt":"2014-07-20T15:22:41Z","messageCount":10,"participants":["René Scharfe","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"246404","messageId":"53CBA59C.8050901@web.de","threadId":"37176","inReplyTo":null,"subject":"[PATCH 0/3] getcwd without PATH_MAX","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T11:18:52Z","receivedAt":"2014-07-20T11:18:52Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Paths longer than PATH_MAX can be created and used on at least on some\nfile systems.  Currently we use getcwd() generally with a PATH_MAX-\nsized buffer.  This short series adds two functions, strbuf_add_cwd()\nand xgetcwd(), then uses them to reduce the number of fixed-sized\nbuffers and to allow us to handle longer working directory paths.\n\nRené Scharfe (3):\n  strbuf: add strbuf_add_cwd()\n  wrapper: add xgetcwd()\n  use xgetcwd() get the current directory or die\n\n Documentation/technical/api-strbuf.txt |  4 ++++\n builtin/init-db.c                      | 17 ++++++++---------\n builtin/rev-parse.c                    |  6 +++---\n dir.c                                  | 12 ++++++++----\n git-compat-util.h                      |  1 +\n strbuf.c                               | 22 ++++++++++++++++++++++\n strbuf.h                               |  1 +\n trace.c                                |  7 ++++---\n wrapper.c                              |  8 ++++++++\n 9 files changed, 59 insertions(+), 19 deletions(-)\n\n-- \n2.0.2\n"},{"id":"246405","messageId":"53CBA62A.5010800@web.de","threadId":"37176","inReplyTo":"53CBA59C.8050901@web.de","subject":"[PATCH 1/3] strbuf: add strbuf_add_cwd()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T11:21:14Z","receivedAt":"2014-07-20T11:21:14Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Add strbuf_add_cwd(), which adds the current working directory to a\nstrbuf.  Because it doesn't use a fixed-size buffer it supports\narbitrarily long paths, as long as the platform's getcwd() does as\nwell.  At least on Linux and FreeBSD it handles paths longer than\nPATH_MAX just fine.\n\nSuggested-by: Karsten Blees <karsten.blees@gmail.com>\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n Documentation/technical/api-strbuf.txt |  4 ++++\n strbuf.c                               | 22 ++++++++++++++++++++++\n strbuf.h                               |  1 +\n 3 files changed, 27 insertions(+)\n\ndiff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt\nindex f9c06a7..b96b78c 100644\n--- a/Documentation/technical/api-strbuf.txt\n+++ b/Documentation/technical/api-strbuf.txt\n@@ -257,6 +257,10 @@ which can be used by the programmer of the callback as she sees fit.\n \n \tAdd a formatted string to the buffer.\n \n+`strbuf_add_cwd`::\n+\n+\tAdd the current working directory to the buffer.\n+\n `strbuf_commented_addf`::\n \n \tAdd a formatted string prepended by a comment character and a\ndiff --git a/strbuf.c b/strbuf.c\nindex 33018d8..4e44773 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -406,6 +406,28 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint)\n \treturn -1;\n }\n \n+int strbuf_add_cwd(struct strbuf *sb)\n+{\n+\tsize_t oldalloc = sb->alloc;\n+\tsize_t guessed_len = 32;\n+\n+\tfor (;; guessed_len *= 2) {\n+\t\tchar *cwd;\n+\n+\t\tstrbuf_grow(sb, guessed_len);\n+\t\tcwd = getcwd(sb->buf + sb->len, sb->alloc - sb->len);\n+\t\tif (cwd) {\n+\t\t\tstrbuf_setlen(sb, sb->len + strlen(cwd));\n+\t\t\treturn 0;\n+\t\t}\n+\t\tif (errno != ERANGE)\n+\t\t\tbreak;\n+\t}\n+\tif (oldalloc == 0)\n+\t\tstrbuf_release(sb);\n+\treturn -1;\n+}\n+\n int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term)\n {\n \tint ch;\ndiff --git a/strbuf.h b/strbuf.h\nindex a7c0192..ba95cd6 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -174,6 +174,7 @@ extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);\n extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);\n extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);\n extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);\n+extern int strbuf_add_cwd(struct strbuf *sb);\n \n extern int strbuf_getwholeline(struct strbuf *, FILE *, int);\n extern int strbuf_getline(struct strbuf *, FILE *, int);\n-- \n2.0.2\n"},{"id":"246406","messageId":"53CBA640.1010601@web.de","threadId":"37176","inReplyTo":"53CBA59C.8050901@web.de","subject":"[PATCH 2/3] wrapper: add xgetcwd()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T11:21:36Z","receivedAt":"2014-07-20T11:21:36Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Add the helper function xgetcwd(), which returns the current directory\nor dies.  The returned string has to be free()d after use.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n git-compat-util.h | 1 +\n wrapper.c         | 8 ++++++++\n 2 files changed, 9 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 0b53c9a..d64d012 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -605,6 +605,7 @@ extern int xmkstemp(char *template);\n extern int xmkstemp_mode(char *template, int mode);\n extern int odb_mkstemp(char *template, size_t limit, const char *pattern);\n extern int odb_pack_keep(char *name, size_t namesz, const unsigned char *sha1);\n+extern char *xgetcwd(void);\n \n static inline size_t xsize_t(off_t len)\n {\ndiff --git a/wrapper.c b/wrapper.c\nindex bc1bfb8..e297fa9 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -493,3 +493,11 @@ struct passwd *xgetpwuid_self(void)\n \t\t    errno ? strerror(errno) : _(\"no such user\"));\n \treturn pw;\n }\n+\n+char *xgetcwd(void)\n+{\n+\tstruct strbuf sb = STRBUF_INIT;\n+\tif (strbuf_add_cwd(&sb))\n+\t\tdie_errno(\"unable to get current working directory\");\n+\treturn strbuf_detach(&sb, NULL);\n+}\n-- \n2.0.2\n"},{"id":"246407","messageId":"53CBA65B.7090504@web.de","threadId":"37176","inReplyTo":"53CBA59C.8050901@web.de","subject":"[PATCH 3/3] use xgetcwd() get the current directory or die","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T11:22:03Z","receivedAt":"2014-07-20T11:22:03Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Convert several calls of getcwd() and die() to use xgetcwd() instead.\nThis way we get rid of fixed-size buffers (which can be too small\ndepending on the used file system) and gain consistent error messages.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n builtin/init-db.c   | 17 ++++++++---------\n builtin/rev-parse.c |  6 +++---\n dir.c               | 12 ++++++++----\n trace.c             |  7 ++++---\n 4 files changed, 23 insertions(+), 19 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 56f85e2..f6dd172 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -426,8 +426,9 @@ int init_db(const char *template_dir, unsigned int flags)\n \n static int guess_repository_type(const char *git_dir)\n {\n-\tchar cwd[PATH_MAX];\n \tconst char *slash;\n+\tchar *cwd;\n+\tint cwd_is_git_dir;\n \n \t/*\n \t * \"GIT_DIR=. git init\" is always bare.\n@@ -435,9 +436,10 @@ static int guess_repository_type(const char *git_dir)\n \t */\n \tif (!strcmp(\".\", git_dir))\n \t\treturn 1;\n-\tif (!getcwd(cwd, sizeof(cwd)))\n-\t\tdie_errno(_(\"cannot tell cwd\"));\n-\tif (!strcmp(git_dir, cwd))\n+\tcwd = xgetcwd();\n+\tcwd_is_git_dir = !strcmp(git_dir, cwd);\n+\tfree(cwd);\n+\tif (cwd_is_git_dir)\n \t\treturn 1;\n \t/*\n \t * \"GIT_DIR=.git or GIT_DIR=something/.git is usually not.\n@@ -572,11 +574,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tgit_work_tree_cfg = xstrdup(real_path(rel));\n \t\t\tfree(rel);\n \t\t}\n-\t\tif (!git_work_tree_cfg) {\n-\t\t\tgit_work_tree_cfg = xcalloc(PATH_MAX, 1);\n-\t\t\tif (!getcwd(git_work_tree_cfg, PATH_MAX))\n-\t\t\t\tdie_errno (_(\"Cannot access current working directory\"));\n-\t\t}\n+\t\tif (!git_work_tree_cfg)\n+\t\t\tgit_work_tree_cfg = xgetcwd();\n \t\tif (work_tree)\n \t\t\tset_git_work_tree(real_path(work_tree));\n \t\telse\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 8102aaa..f6bbac7 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -735,7 +735,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--git-dir\")) {\n \t\t\t\tconst char *gitdir = getenv(GIT_DIR_ENVIRONMENT);\n-\t\t\t\tstatic char cwd[PATH_MAX];\n+\t\t\t\tchar *cwd;\n \t\t\t\tint len;\n \t\t\t\tif (gitdir) {\n \t\t\t\t\tputs(gitdir);\n@@ -745,10 +745,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\t\tputs(\".git\");\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n-\t\t\t\tif (!getcwd(cwd, PATH_MAX))\n-\t\t\t\t\tdie_errno(\"unable to get current working directory\");\n+\t\t\t\tcwd = xgetcwd();\n \t\t\t\tlen = strlen(cwd);\n \t\t\t\tprintf(\"%s%s.git\\n\", cwd, len && cwd[len-1] != '/' ? \"/\" : \"\");\n+\t\t\t\tfree(cwd);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--resolve-git-dir\")) {\ndiff --git a/dir.c b/dir.c\nindex e65888d..7b994d4 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -1499,12 +1499,16 @@ int dir_inside_of(const char *subdir, const char *dir)\n \n int is_inside_dir(const char *dir)\n {\n-\tchar cwd[PATH_MAX];\n+\tchar *cwd;\n+\tint rc;\n+\n \tif (!dir)\n \t\treturn 0;\n-\tif (!getcwd(cwd, sizeof(cwd)))\n-\t\tdie_errno(\"can't find the current directory\");\n-\treturn dir_inside_of(cwd, dir) >= 0;\n+\n+\tcwd = xgetcwd();\n+\trc = (dir_inside_of(cwd, dir) >= 0);\n+\tfree(cwd);\n+\treturn rc;\n }\n \n int is_empty_dir(const char *path)\ndiff --git a/trace.c b/trace.c\nindex 08180a9..3523667 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -158,13 +158,12 @@ void trace_repo_setup(const char *prefix)\n {\n \tstatic const char *key = \"GIT_TRACE_SETUP\";\n \tconst char *git_work_tree;\n-\tchar cwd[PATH_MAX];\n+\tchar *cwd;\n \n \tif (!trace_want(key))\n \t\treturn;\n \n-\tif (!getcwd(cwd, PATH_MAX))\n-\t\tdie(\"Unable to get current working directory\");\n+\tcwd = xgetcwd();\n \n \tif (!(git_work_tree = get_git_work_tree()))\n \t\tgit_work_tree = \"(null)\";\n@@ -176,6 +175,8 @@ void trace_repo_setup(const char *prefix)\n \ttrace_printf_key(key, \"setup: worktree: %s\\n\", quote_crnl(git_work_tree));\n \ttrace_printf_key(key, \"setup: cwd: %s\\n\", quote_crnl(cwd));\n \ttrace_printf_key(key, \"setup: prefix: %s\\n\", quote_crnl(prefix));\n+\n+\tfree(cwd);\n }\n \n int trace_want(const char *key)\n-- \n2.0.2\n"},{"id":"246410","messageId":"CACsJy8BHJ8UFbnEn6C7FiA2SNvL5hZSZg5iDd6CQPDxt+bUJHQ@mail.gmail.com","threadId":"37176","inReplyTo":"53CBA62A.5010800@web.de","subject":"Re: [PATCH 1/3] strbuf: add strbuf_add_cwd()","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-07-20T12:33:54Z","receivedAt":"2014-07-20T12:33:54Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Jul 20, 2014 at 6:21 PM, René Scharfe <l.s.r@web.de> wrote:\n> +int strbuf_add_cwd(struct strbuf *sb)\n> +{\n> +       size_t oldalloc = sb->alloc;\n> +       size_t guessed_len = 32;\n\nFor Linux, I think this is enough to succesfully get cwd in the first\npass. Windows' $HOME is usually deep in C:\\Users\\Blahblah. Maybe\nincrease this to 128? And we probably want to keep the guessed value,\nso if the first strbuf_add_cwd needs a few rounds to get cwd, the next\nstrbuf_add_cwd() call does not.\n\n> +\n> +       for (;; guessed_len *= 2) {\n> +               char *cwd;\n> +\n> +               strbuf_grow(sb, guessed_len);\n> +               cwd = getcwd(sb->buf + sb->len, sb->alloc - sb->len);\n> +               if (cwd) {\n> +                       strbuf_setlen(sb, sb->len + strlen(cwd));\n> +                       return 0;\n> +               }\n> +               if (errno != ERANGE)\n> +                       break;\n> +       }\n> +       if (oldalloc == 0)\n> +               strbuf_release(sb);\n> +       return -1;\n> +}\n\nThe loop and the following strbuf_release() are correct. But I wonder\nif it's easier to read if you save getcwd in a separate/local strbuf\nvariable and only concat it to \"sb\" when you successfully get cwd..\n-- \nDuy\n"},{"id":"246411","messageId":"CACsJy8BUaAkO8_fjGCtVDyoSKkBQ+VKJLtjN_HZfV7XHOnS_yA@mail.gmail.com","threadId":"37176","inReplyTo":"53CBA640.1010601@web.de","subject":"Re: [PATCH 2/3] wrapper: add xgetcwd()","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-07-20T12:35:40Z","receivedAt":"2014-07-20T12:35:40Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Jul 20, 2014 at 6:21 PM, René Scharfe <l.s.r@web.de> wrote:\n> +char *xgetcwd(void)\n> +{\n> +       struct strbuf sb = STRBUF_INIT;\n> +       if (strbuf_add_cwd(&sb))\n> +               die_errno(\"unable to get current working directory\");\n\nWrap the string with _() to make it translatable? I can't see why any\nscript would want to grep this string..\n\n> +       return strbuf_detach(&sb, NULL);\n> +}\n-- \nDuy\n"},{"id":"246412","messageId":"CACsJy8CX5iDejuKZSEoeP_mNCyGzpZ+vQteYfQosw6x6aBJvbw@mail.gmail.com","threadId":"37176","inReplyTo":"53CBA65B.7090504@web.de","subject":"Re: [PATCH 3/3] use xgetcwd() get the current directory or die","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-07-20T12:45:33Z","receivedAt":"2014-07-20T12:45:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Jul 20, 2014 at 6:22 PM, René Scharfe <l.s.r@web.de> wrote:\n> Convert several calls of getcwd() and die() to use xgetcwd() instead.\n> This way we get rid of fixed-size buffers (which can be too small\n> depending on the used file system) and gain consistent error messages.\n>\n> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n> ---\n>  builtin/init-db.c   | 17 ++++++++---------\n>  builtin/rev-parse.c |  6 +++---\n>  dir.c               | 12 ++++++++----\n>  trace.c             |  7 ++++---\n>  4 files changed, 23 insertions(+), 19 deletions(-)\n\nThere should be a 4/3 to replace the remaining getcwd with\nstrbuf_getcwd. But I guess we could add that to the low hanging fruit\nlist.\n-- \nDuy\n"},{"id":"246415","messageId":"53CBDE8F.7000804@web.de","threadId":"37176","inReplyTo":"CACsJy8BHJ8UFbnEn6C7FiA2SNvL5hZSZg5iDd6CQPDxt+bUJHQ@mail.gmail.com","subject":"Re: [PATCH 1/3] strbuf: add strbuf_add_cwd()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T15:21:51Z","receivedAt":"2014-07-20T15:21:51Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 20.07.2014 14:33, schrieb Duy Nguyen:\n> On Sun, Jul 20, 2014 at 6:21 PM, René Scharfe <l.s.r@web.de> wrote:\n>> +int strbuf_add_cwd(struct strbuf *sb)\n>> +{\n>> +       size_t oldalloc = sb->alloc;\n>> +       size_t guessed_len = 32;\n>\n> For Linux, I think this is enough to succesfully get cwd in the first\n> pass. Windows' $HOME is usually deep in C:\\Users\\Blahblah. Maybe\n> increase this to 128? And we probably want to keep the guessed value,\n> so if the first strbuf_add_cwd needs a few rounds to get cwd, the next\n> strbuf_add_cwd() call does not.\n\nThe initial number is debatable, sure.  I just copied the 32 from \nstrbuf_readline().\n\n\"C:\\Users\\John Doe\\Documents\\Projects\\foo\" (or whatever) isn't thaaat \nlong either, though.  FWIW, the longest (non-hidden) path in my home on \nWindows 8.1 is 139 characters long (as reported by dir -r | %{ \n$_.FullName.Length } | sort -desc | select -f 1), but there are no git \nprojects in that directory.  Not sure if that means 128 would be a \nbetter start value, but I don't mind changing it in any case.\n\nBefore adding performance optimizations like remembering the last cwd \nlength I'd rather see measurements that demonstrate their use.  I doubt \nwe'll see getcwd() show up high on a profile (but didn't measure, except \nfor a run of t/perf).\n\n>> +\n>> +       for (;; guessed_len *= 2) {\n>> +               char *cwd;\n>> +\n>> +               strbuf_grow(sb, guessed_len);\n>> +               cwd = getcwd(sb->buf + sb->len, sb->alloc - sb->len);\n>> +               if (cwd) {\n>> +                       strbuf_setlen(sb, sb->len + strlen(cwd));\n>> +                       return 0;\n>> +               }\n>> +               if (errno != ERANGE)\n>> +                       break;\n>> +       }\n>> +       if (oldalloc == 0)\n>> +               strbuf_release(sb);\n>> +       return -1;\n>> +}\n>\n> The loop and the following strbuf_release() are correct. But I wonder\n> if it's easier to read if you save getcwd in a separate/local strbuf\n> variable and only concat it to \"sb\" when you successfully get cwd..\n\nAdding an extra allocation and string copy sound more complicated.  But \nyou are right that the function is more complicated than necessary. \nReroll coming..\n\nRené\n"},{"id":"246416","messageId":"53CBDE95.7050105@web.de","threadId":"37176","inReplyTo":"CACsJy8CX5iDejuKZSEoeP_mNCyGzpZ+vQteYfQosw6x6aBJvbw@mail.gmail.com","subject":"Re: [PATCH 3/3] use xgetcwd() get the current directory or die","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T15:21:57Z","receivedAt":"2014-07-20T15:21:57Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 20.07.2014 14:45, schrieb Duy Nguyen:\n> On Sun, Jul 20, 2014 at 6:22 PM, René Scharfe <l.s.r@web.de> wrote:\n>> Convert several calls of getcwd() and die() to use xgetcwd() instead.\n>> This way we get rid of fixed-size buffers (which can be too small\n>> depending on the used file system) and gain consistent error messages.\n>>\n>> Signed-off-by: Rene Scharfe <l.s.r@web.de>\n>> ---\n>>   builtin/init-db.c   | 17 ++++++++---------\n>>   builtin/rev-parse.c |  6 +++---\n>>   dir.c               | 12 ++++++++----\n>>   trace.c             |  7 ++++---\n>>   4 files changed, 23 insertions(+), 19 deletions(-)\n>\n> There should be a 4/3 to replace the remaining getcwd with\n> strbuf_getcwd. But I guess we could add that to the low hanging fruit\n> list.\n\nI left out the cases with the go-there-then-come-back pattern on \npurpose, as they hopefully can be changed to cease using getcwd() in the \nfirst place.  But I'll include another example (in addition to \nxgetcwd()) in the reroll.\n\nRené\n"},{"id":"246417","messageId":"53CBDEC1.7010800@web.de","threadId":"37176","inReplyTo":"CACsJy8BUaAkO8_fjGCtVDyoSKkBQ+VKJLtjN_HZfV7XHOnS_yA@mail.gmail.com","subject":"Re: [PATCH 2/3] wrapper: add xgetcwd()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-20T15:22:41Z","receivedAt":"2014-07-20T15:22:41Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 20.07.2014 14:35, schrieb Duy Nguyen:\n> On Sun, Jul 20, 2014 at 6:21 PM, René Scharfe <l.s.r@web.de> wrote:\n>> +char *xgetcwd(void)\n>> +{\n>> +       struct strbuf sb = STRBUF_INIT;\n>> +       if (strbuf_add_cwd(&sb))\n>> +               die_errno(\"unable to get current working directory\");\n>\n> Wrap the string with _() to make it translatable? I can't see why any\n> script would want to grep this string..\n\nSure, good idea.\n\n>\n>> +       return strbuf_detach(&sb, NULL);\n>> +}\n\nThank you for the review,\nRené\n"}]}