git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Karsten Blees" <karsten.blees@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 0/4] getcwd without PATH_MAX
Date: Sun, 20 Jul 2014 18:46:47 +0200	[thread overview]
Message-ID: <53CBF277.3090101@web.de> (raw)

Paths longer than PATH_MAX can be created and used on at least on some
file systems.  Currently we use getcwd() generally with a PATH_MAX-
sized buffer.  This series adds two functions, strbuf_getcwd() and
xgetcwd(), then uses them to reduce the number of fixed-sized buffers
and to allow us to handle longer working directory paths.

Not all getcwd() calls are replaced, however.  I hope that at least
some of the remaining ones can be avoided altogether.  If that turns
out to be too optimistic then we can use the added function to convert
the rest.

Changes in v2:
  * strbuf_getcwd() instead of strbuf_add_cwd(), because the former is
    simpler and sufficient for now; based on a suggestion by Duy
  * added patch 2 as an example for strbuf_getcwd() usage, suggested
    by Duy
  * made sure strbuf_getcwd() leaves the strbuf intact, no matter
    what getcwd() does
  * converted an easy getcwd() call in setup.c

René Scharfe (4):
  strbuf: add strbuf_getcwd()
  use strbuf_getcwd() to get the current working directory without
    fixed-sized buffers
  wrapper: add xgetcwd()
  use xgetcwd() get the current directory or die

 Documentation/technical/api-strbuf.txt |  4 ++++
 builtin/init-db.c                      | 25 ++++++++++++-------------
 builtin/rev-parse.c                    |  6 +++---
 dir.c                                  | 12 ++++++++----
 git-compat-util.h                      |  1 +
 git.c                                  |  6 ++++--
 setup.c                                |  6 +++---
 strbuf.c                               | 21 +++++++++++++++++++++
 strbuf.h                               |  1 +
 trace.c                                |  7 ++++---
 wrapper.c                              |  8 ++++++++
 11 files changed, 69 insertions(+), 28 deletions(-)

-- 
2.0.2

             reply	other threads:[~2014-07-20 16:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 16:46 René Scharfe [this message]
2014-07-20 16:49 ` [PATCH v2 1/4] strbuf: add strbuf_getcwd() René Scharfe
2014-07-20 16:49 ` [PATCH v2 2/4] use strbuf_getcwd() to get the current working directory without fixed-sized buffers René Scharfe
2014-07-21  2:33   ` Jeff King
2014-07-21 17:10     ` René Scharfe
2014-07-22 10:43       ` Jeff King
2014-07-21 19:02     ` Junio C Hamano
2014-07-20 16:50 ` [PATCH v2 3/4] wrapper: add xgetcwd() René Scharfe
2014-07-20 16:51 ` [PATCH v2 4/4] use xgetcwd() get the current directory or die René Scharfe

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=53CBF277.3090101@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karsten.blees@gmail.com \
    --cc=pclouds@gmail.com \
    /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).