From: David Turner <dturner@twosigma.com> To: git@vger.kernel.org Cc: David Turner <dturner@twosigma.com> Subject: [PATCH v3] http.postbuffer: allow full range of ssize_t values Date: Fri, 31 Mar 2017 13:26:31 -0400 [thread overview] Message-ID: <20170331172631.12024-1-dturner@twosigma.com> (raw) Unfortunately, in order to push some large repos, the http postbuffer must sometimes exceed two gigabytes. On a 64-bit system, this is OK: we just malloc a larger buffer. Signed-off-by: David Turner <dturner@twosigma.com> --- This version fixes the definition of git_parse_ssize_t to return int. Sorry for the sloppiness. cache.h | 1 + config.c | 17 +++++++++++++++++ http.c | 4 ++-- http.h | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index fbdf7a815a..5e6747dbb4 100644 --- a/cache.h +++ b/cache.h @@ -1900,6 +1900,7 @@ extern int git_parse_maybe_bool(const char *); extern int git_config_int(const char *, const char *); extern int64_t git_config_int64(const char *, const char *); extern unsigned long git_config_ulong(const char *, const char *); +extern ssize_t git_config_ssize_t(const char *, const char *); extern int git_config_bool_or_int(const char *, const char *, int *); extern int git_config_bool(const char *, const char *); extern int git_config_maybe_bool(const char *, const char *); diff --git a/config.c b/config.c index 1a4d85537b..de5b155a4e 100644 --- a/config.c +++ b/config.c @@ -834,6 +834,15 @@ int git_parse_ulong(const char *value, unsigned long *ret) return 1; } +static int git_parse_ssize_t(const char *value, ssize_t *ret) +{ + ssize_t tmp; + if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(ssize_t))) + return 0; + *ret = tmp; + return 1; +} + NORETURN static void die_bad_number(const char *name, const char *value) { @@ -892,6 +901,14 @@ unsigned long git_config_ulong(const char *name, const char *value) return ret; } +ssize_t git_config_ssize_t(const char *name, const char *value) +{ + ssize_t ret; + if (!git_parse_ssize_t(value, &ret)) + die_bad_number(name, value); + return ret; +} + int git_parse_maybe_bool(const char *value) { if (!value) diff --git a/http.c b/http.c index 96d84bbed3..22f8167ba2 100644 --- a/http.c +++ b/http.c @@ -19,7 +19,7 @@ long int git_curl_ipresolve; #endif int active_requests; int http_is_verbose; -size_t http_post_buffer = 16 * LARGE_PACKET_MAX; +ssize_t http_post_buffer = 16 * LARGE_PACKET_MAX; #if LIBCURL_VERSION_NUM >= 0x070a06 #define LIBCURL_CAN_HANDLE_AUTH_ANY @@ -331,7 +331,7 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.postbuffer", var)) { - http_post_buffer = git_config_int(var, value); + http_post_buffer = git_config_ssize_t(var, value); if (http_post_buffer < LARGE_PACKET_MAX) http_post_buffer = LARGE_PACKET_MAX; return 0; diff --git a/http.h b/http.h index 02bccb7b0c..f7bd3b26b0 100644 --- a/http.h +++ b/http.h @@ -111,7 +111,7 @@ extern struct curl_slist *http_copy_default_headers(void); extern long int git_curl_ipresolve; extern int active_requests; extern int http_is_verbose; -extern size_t http_post_buffer; +extern ssize_t http_post_buffer; extern struct credential http_auth; extern char curl_errorstr[CURL_ERROR_SIZE]; -- 2.11.GIT
next reply other threads:[~2017-03-31 17:26 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-03-31 17:26 David Turner [this message] 2017-03-31 19:51 ` Junio C Hamano 2017-04-01 6:01 ` Jeff King 2017-04-01 18:09 ` Junio C Hamano 2017-04-03 17:03 ` David Turner 2017-04-04 2:01 ` Jeff King 2017-04-04 18:42 ` David Turner 2017-04-04 20:40 ` Jeff King 2017-04-06 17:24 ` Christian Couder 2017-04-07 4:48 ` Jeff King
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=20170331172631.12024-1-dturner@twosigma.com \ --to=dturner@twosigma.com \ --cc=git@vger.kernel.org \ --subject='Re: [PATCH v3] http.postbuffer: allow full range of ssize_t values' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.