{"thread":{"id":"43926","subject":"[PATCH v3 1/3] index-pack: add --max-input-size=<size> option","startedAt":"2016-08-24T18:42:29Z","lastAt":"2016-08-24T19:30:55Z","messageCount":6,"participants":["Christian Couder","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"300098","messageId":"20160824184157.19264-2-chriscool@tuxfamily.org","threadId":"43926","inReplyTo":"20160824184157.19264-1-chriscool@tuxfamily.org","subject":"[PATCH v3 1/3] index-pack: add --max-input-size=<size> option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-24T18:41:55Z","receivedAt":"2016-08-24T18:42:29Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nWhen receiving a pack-file, it can be useful to abort the\n`git index-pack`, if the pack-file is too big.\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/git-index-pack.txt | 2 ++\n builtin/index-pack.c             | 5 +++++\n 2 files changed, 7 insertions(+)\n\ndiff --git a/Documentation/git-index-pack.txt b/Documentation/git-index-pack.txt\nindex 7a4e055..1b4b65d 100644\n--- a/Documentation/git-index-pack.txt\n+++ b/Documentation/git-index-pack.txt\n@@ -87,6 +87,8 @@ OPTIONS\n \tSpecifying 0 will cause Git to auto-detect the number of CPU's\n \tand use maximum 3 threads.\n \n+--max-input-size=<size>::\n+\tDie, if the pack is larger than <size>.\n \n Note\n ----\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 1d2ea58..4a8b4ae 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -87,6 +87,7 @@ static struct progress *progress;\n static unsigned char input_buffer[4096];\n static unsigned int input_offset, input_len;\n static off_t consumed_bytes;\n+static off_t max_input_size;\n static unsigned deepest_delta;\n static git_SHA_CTX input_ctx;\n static uint32_t input_crc32;\n@@ -297,6 +298,8 @@ static void use(int bytes)\n \tif (signed_add_overflows(consumed_bytes, bytes))\n \t\tdie(_(\"pack too large for current definition of off_t\"));\n \tconsumed_bytes += bytes;\n+\tif (max_input_size && consumed_bytes > max_input_size)\n+\t\tdie(_(\"pack exceeds maximum allowed size\"));\n }\n \n static const char *open_pack_file(const char *pack_name)\n@@ -1714,6 +1717,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \t\t\t\t\topts.off32_limit = strtoul(c+1, &c, 0);\n \t\t\t\tif (*c || opts.off32_limit & 0x80000000)\n \t\t\t\t\tdie(_(\"bad %s\"), arg);\n+\t\t\t} else if (skip_prefix(arg, \"--max-input-size=\", &arg)) {\n+\t\t\t\tmax_input_size = strtoumax(arg, NULL, 10);\n \t\t\t} else\n \t\t\t\tusage(index_pack_usage);\n \t\t\tcontinue;\n-- \n2.10.0.rc1.3.g93be2b9\n\n"},{"id":"300099","messageId":"20160824184157.19264-3-chriscool@tuxfamily.org","threadId":"43926","inReplyTo":"20160824184157.19264-1-chriscool@tuxfamily.org","subject":"[PATCH v3 2/3] unpack-objects: add --max-input-size=<size> option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-24T18:41:56Z","receivedAt":"2016-08-24T18:42:38Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"When receiving a pack-file, it can be useful to abort the\n`git unpack-objects`, if the pack-file is too big.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/git-unpack-objects.txt | 3 +++\n builtin/unpack-objects.c             | 7 +++++++\n 2 files changed, 10 insertions(+)\n\ndiff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt\nindex 3e887d1..b3de50d 100644\n--- a/Documentation/git-unpack-objects.txt\n+++ b/Documentation/git-unpack-objects.txt\n@@ -44,6 +44,9 @@ OPTIONS\n --strict::\n \tDon't write objects with broken content or links.\n \n+--max-input-size=<size>::\n+\tDie, if the pack is larger than <size>.\n+\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 172470b..4532aa0 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -19,6 +19,7 @@ static const char unpack_usage[] = \"git unpack-objects [-n] [-q] [-r] [--strict]\n static unsigned char buffer[4096];\n static unsigned int offset, len;\n static off_t consumed_bytes;\n+static off_t max_input_size;\n static git_SHA_CTX ctx;\n static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;\n \n@@ -87,6 +88,8 @@ static void use(int bytes)\n \tif (signed_add_overflows(consumed_bytes, bytes))\n \t\tdie(\"pack too large for current definition of off_t\");\n \tconsumed_bytes += bytes;\n+\tif (max_input_size && consumed_bytes > max_input_size)\n+\t\tdie(_(\"pack exceeds maximum allowed size\"));\n }\n \n static void *get_data(unsigned long size)\n@@ -550,6 +553,10 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)\n \t\t\t\tlen = sizeof(*hdr);\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (skip_prefix(arg, \"--max-input-size=\", &arg)) {\n+\t\t\t\tmax_input_size = strtoumax(arg, NULL, 10);\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tusage(unpack_usage);\n \t\t}\n \n-- \n2.10.0.rc1.3.g93be2b9\n\n"},{"id":"300100","messageId":"20160824184157.19264-1-chriscool@tuxfamily.org","threadId":"43926","inReplyTo":null,"subject":"[PATCH v3 0/3] limit the size of the packs we receive","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-24T18:41:54Z","receivedAt":"2016-08-24T18:42:41Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Goal\n~~~~\n\nIn https://public-inbox.org/git/20150612182045.GA23698%40peff.net/,\nPeff sent a patch that is used by GitHub to abort `git receive-pack`\nwhen the size of the pack we receive is bigger than a configured\nlimit.\n\nGitLab is interested in using the same approach and in standardizing\nthe error messages the user could get back.\n\nComments\n~~~~~~~~\n\nI kept Peff as the author of the patches that are made mostly from his\npatch, but I added my Signed-off-by to them.\n\nChanges from previous v2 version\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nAll these changes have been suggested by Junio and are in patch 3/3,\nthe other 2 patches are the same as v2:\n\n  - renamed \"receive.maxsize\" to \"receive.maxInputSize\",\n  - improved commit message,\n  - renamed test script from \"t5546-push-limits.sh\" to\n    \"t5546-receive-limits.sh\",\n  - improved the tests in the last patch by adding a\n    test_pack_input_limit() function and deleting the destination repo\n    at the beginning of this function.\n\nLinks\n~~~~~\n\nThis patch series is available here:\n\nhttps://github.com/chriscool/git/commits/max-receive\n\nThe previous versions are here on GitHub:\n\nRFC: https://github.com/chriscool/git/commits/max-receive2\nv1: https://github.com/chriscool/git/commits/max-receive6\nv2: https://github.com/chriscool/git/commits/max-receive7\n\nand here on the list:\n\nRFC: https://public-inbox.org/git/20160815195729.16826-1-chriscool@tuxfamily.org/\nv1: https://public-inbox.org/git/20160816081701.29949-1-chriscool@tuxfamily.org/\nv2: https://public-inbox.org/git/20160818131553.22580-1-chriscool@tuxfamily.org/\n\nPeff's initial patch is:\n\nhttps://public-inbox.org/git/20150612182045.GA23698%40peff.net/\n\nDiff with previous v2 version\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f5b6061..8a115b3 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2517,10 +2517,11 @@ receive.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n-receive.maxsize::\n-\tIf the size of a pack file is larger than this limit, then\n-\tgit-receive-pack will error out, instead of accepting the pack\n-\tfile. If not set or set to 0, then the size is unlimited.\n+receive.maxInputSize::\n+\tIf the size of the incoming pack stream is larger than this\n+\tlimit, then git-receive-pack will error out, instead of\n+\taccepting the pack file. If not set or set to 0, then the size\n+\tis unlimited.\n \n receive.denyDeletes::\n \tIf set to true, git-receive-pack will deny a ref update that deletes\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 4b0379b..f1ce05c 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -213,7 +213,7 @@ static int receive_pack_config(const char *var, const char *value, void *cb)\n \t\treturn 0;\n \t}\n \n-\tif (strcmp(var, \"receive.maxsize\") == 0) {\n+\tif (strcmp(var, \"receive.maxinputsize\") == 0) {\n \t\tmax_input_size = git_config_int64(var, value);\n \t\treturn 0;\n \t}\ndiff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh\ndeleted file mode 100755\nindex 09e958f..0000000\n--- a/t/t5546-push-limits.sh\n+++ /dev/null\n@@ -1,42 +0,0 @@\n-#!/bin/sh\n-\n-test_description='check input limits for pushing'\n-. ./test-lib.sh\n-\n-test_expect_success 'create remote repository' '\n-\tgit init --bare dest\n-'\n-\n-# Let's run tests with different unpack limits: 1 and 10\n-# When the limit is 1, `git receive-pack` will call `git index-pack`.\n-# When the limit is 10, `git receive-pack` will call `git unpack-objects`.\n-\n-while read unpacklimit filesize filename seed\n-do\n-\n-\ttest_expect_success \"create known-size ($filesize bytes) commit '$filename'\" '\n-\t\ttest-genrandom \"$seed\" \"$filesize\" >\"$filename\" &&\n-\t\tgit add \"$filename\" &&\n-\t\ttest_commit \"$filename\"\n-\t'\n-\n-\ttest_expect_success \"set unpacklimit to $unpacklimit\" '\n-\t\tgit --git-dir=dest config receive.unpacklimit \"$unpacklimit\"\n-\t'\n-\n-\ttest_expect_success 'setting receive.maxsize to 512 rejects push' '\n-\t\tgit --git-dir=dest config receive.maxsize 512 &&\n-\t\ttest_must_fail git push dest HEAD\n-\t'\n-\n-\ttest_expect_success 'bumping limit to 4k allows push' '\n-\t\tgit --git-dir=dest config receive.maxsize 4k &&\n-\t\tgit push dest HEAD\n-\t'\n-\n-done <<\\EOF\n-1 1024 one-k-file foo\n-10 1024 other-one-k-file bar\n-EOF\n-\n-test_done\ndiff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh\nnew file mode 100755\nindex 0000000..10cb0be\n--- /dev/null\n+++ b/t/t5546-receive-limits.sh\n@@ -0,0 +1,55 @@\n+#!/bin/sh\n+\n+test_description='check receive input limits'\n+. ./test-lib.sh\n+\n+# Let's run tests with different unpack limits: 1 and 10000\n+# When the limit is 1, `git receive-pack` will call `git index-pack`.\n+# When the limit is 10000, `git receive-pack` will call `git unpack-objects`.\n+\n+test_pack_input_limit () {\n+\tcase \"$1\" in\n+\tindex) unpack_limit=1 ;;\n+\tunpack) unpack_limit=10000 ;;\n+\tesac\n+\n+\ttest_expect_success 'prepare destination repository' '\n+\t\trm -fr dest &&\n+\t\tgit --bare init dest\n+\t'\n+\n+\ttest_expect_success \"set unpacklimit to $unpack_limit\" '\n+\t\tgit --git-dir=dest config receive.unpacklimit \"$unpack_limit\"\n+\t'\n+\n+\ttest_expect_success 'setting receive.maxInputSize to 512 rejects push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 512 &&\n+\t\ttest_must_fail git push dest HEAD\n+\t'\n+\n+\ttest_expect_success 'bumping limit to 4k allows push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 4k &&\n+\t\tgit push dest HEAD\n+\t'\n+\n+\ttest_expect_success 'prepare destination repository (again)' '\n+\t\trm -fr dest &&\n+\t\tgit --bare init dest\n+\t'\n+\n+\ttest_expect_success 'lifting the limit allows push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 0 &&\n+\t\tgit push dest HEAD\n+\t'\n+}\n+\n+test_expect_success \"create known-size (1024 bytes) commit\" '\n+\ttest-genrandom foo 1024 >one-k &&\n+\tgit add one-k &&\n+\ttest_commit one-k\n+'\n+\n+test_pack_input_limit index\n+test_pack_input_limit unpack\n+\n+test_done\n---\n\nChristian Couder (1):\n  unpack-objects: add --max-input-size=<size> option\n\nJeff King (2):\n  index-pack: add --max-input-size=<size> option\n  receive-pack: allow a maximum input size to be specified\n\n Documentation/config.txt             |  6 ++++\n Documentation/git-index-pack.txt     |  2 ++\n Documentation/git-receive-pack.txt   |  3 ++\n Documentation/git-unpack-objects.txt |  3 ++\n builtin/index-pack.c                 |  5 ++++\n builtin/receive-pack.c               | 12 ++++++++\n builtin/unpack-objects.c             |  7 +++++\n t/t5546-receive-limits.sh            | 55 ++++++++++++++++++++++++++++++++++++\n 8 files changed, 93 insertions(+)\n create mode 100755 t/t5546-receive-limits.sh\n\n-- \n2.10.0.rc1.3.g93be2b9\n\n"},{"id":"300101","messageId":"20160824184157.19264-4-chriscool@tuxfamily.org","threadId":"43926","inReplyTo":"20160824184157.19264-1-chriscool@tuxfamily.org","subject":"[PATCH v3 3/3] receive-pack: allow a maximum input size to be specified","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-24T18:41:57Z","receivedAt":"2016-08-24T18:42:43Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nReceive-pack feeds its input to either index-pack or\nunpack-objects, which will happily accept as many bytes as\na sender is willing to provide. Let's allow an arbitrary\ncutoff point where we will stop writing bytes to disk.\n\nCleaning up what has already been written to disk is a\nrelated problem that is not addressed by this patch.\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/config.txt           |  6 +++++\n Documentation/git-receive-pack.txt |  3 +++\n builtin/receive-pack.c             | 12 +++++++++\n t/t5546-receive-limits.sh          | 55 ++++++++++++++++++++++++++++++++++++++\n 4 files changed, 76 insertions(+)\n create mode 100755 t/t5546-receive-limits.sh\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 0bcb679..8a115b3 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2517,6 +2517,12 @@ receive.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n+receive.maxInputSize::\n+\tIf the size of the incoming pack stream is larger than this\n+\tlimit, then git-receive-pack will error out, instead of\n+\taccepting the pack file. If not set or set to 0, then the size\n+\tis unlimited.\n+\n receive.denyDeletes::\n \tIf set to true, git-receive-pack will deny a ref update that deletes\n \tthe ref. Use this to prevent such a ref deletion via a push.\ndiff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt\nindex 000ee8d..0ccd5fb 100644\n--- a/Documentation/git-receive-pack.txt\n+++ b/Documentation/git-receive-pack.txt\n@@ -33,6 +33,9 @@ post-update hooks found in the Documentation/howto directory.\n option, which tells it if updates to a ref should be denied if they\n are not fast-forwards.\n \n+A number of other receive.* config options are available to tweak\n+its behavior, see linkgit:git-config[1].\n+\n OPTIONS\n -------\n <directory>::\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 011db00..f1ce05c 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -46,6 +46,7 @@ static int transfer_unpack_limit = -1;\n static int advertise_atomic_push = 1;\n static int advertise_push_options;\n static int unpack_limit = 100;\n+static off_t max_input_size;\n static int report_status;\n static int use_sideband;\n static int use_atomic;\n@@ -212,6 +213,11 @@ static int receive_pack_config(const char *var, const char *value, void *cb)\n \t\treturn 0;\n \t}\n \n+\tif (strcmp(var, \"receive.maxinputsize\") == 0) {\n+\t\tmax_input_size = git_config_int64(var, value);\n+\t\treturn 0;\n+\t}\n+\n \treturn git_default_config(var, value, cb);\n }\n \n@@ -1648,6 +1654,9 @@ static const char *unpack(int err_fd, struct shallow_info *si)\n \t\tif (fsck_objects)\n \t\t\targv_array_pushf(&child.args, \"--strict%s\",\n \t\t\t\tfsck_msg_types.buf);\n+\t\tif (max_input_size)\n+\t\t\targv_array_pushf(&child.args, \"--max-input-size=%\"PRIuMAX,\n+\t\t\t\t(uintmax_t)max_input_size);\n \t\tchild.no_stdout = 1;\n \t\tchild.err = err_fd;\n \t\tchild.git_cmd = 1;\n@@ -1676,6 +1685,9 @@ static const char *unpack(int err_fd, struct shallow_info *si)\n \t\t\t\tfsck_msg_types.buf);\n \t\tif (!reject_thin)\n \t\t\targv_array_push(&child.args, \"--fix-thin\");\n+\t\tif (max_input_size)\n+\t\t\targv_array_pushf(&child.args, \"--max-input-size=%\"PRIuMAX,\n+\t\t\t\t(uintmax_t)max_input_size);\n \t\tchild.out = -1;\n \t\tchild.err = err_fd;\n \t\tchild.git_cmd = 1;\ndiff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh\nnew file mode 100755\nindex 0000000..10cb0be\n--- /dev/null\n+++ b/t/t5546-receive-limits.sh\n@@ -0,0 +1,55 @@\n+#!/bin/sh\n+\n+test_description='check receive input limits'\n+. ./test-lib.sh\n+\n+# Let's run tests with different unpack limits: 1 and 10000\n+# When the limit is 1, `git receive-pack` will call `git index-pack`.\n+# When the limit is 10000, `git receive-pack` will call `git unpack-objects`.\n+\n+test_pack_input_limit () {\n+\tcase \"$1\" in\n+\tindex) unpack_limit=1 ;;\n+\tunpack) unpack_limit=10000 ;;\n+\tesac\n+\n+\ttest_expect_success 'prepare destination repository' '\n+\t\trm -fr dest &&\n+\t\tgit --bare init dest\n+\t'\n+\n+\ttest_expect_success \"set unpacklimit to $unpack_limit\" '\n+\t\tgit --git-dir=dest config receive.unpacklimit \"$unpack_limit\"\n+\t'\n+\n+\ttest_expect_success 'setting receive.maxInputSize to 512 rejects push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 512 &&\n+\t\ttest_must_fail git push dest HEAD\n+\t'\n+\n+\ttest_expect_success 'bumping limit to 4k allows push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 4k &&\n+\t\tgit push dest HEAD\n+\t'\n+\n+\ttest_expect_success 'prepare destination repository (again)' '\n+\t\trm -fr dest &&\n+\t\tgit --bare init dest\n+\t'\n+\n+\ttest_expect_success 'lifting the limit allows push' '\n+\t\tgit --git-dir=dest config receive.maxInputSize 0 &&\n+\t\tgit push dest HEAD\n+\t'\n+}\n+\n+test_expect_success \"create known-size (1024 bytes) commit\" '\n+\ttest-genrandom foo 1024 >one-k &&\n+\tgit add one-k &&\n+\ttest_commit one-k\n+'\n+\n+test_pack_input_limit index\n+test_pack_input_limit unpack\n+\n+test_done\n-- \n2.10.0.rc1.3.g93be2b9\n\n"},{"id":"300105","messageId":"20160824185428.6k6tatv4cc5pre5c@sigill.intra.peff.net","threadId":"43926","inReplyTo":"20160824184157.19264-4-chriscool@tuxfamily.org","subject":"Re: [PATCH v3 3/3] receive-pack: allow a maximum input size to be specified","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-24T18:54:28Z","receivedAt":"2016-08-24T19:01:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 24, 2016 at 08:41:57PM +0200, Christian Couder wrote:\n\n> +test_pack_input_limit () {\n> +\tcase \"$1\" in\n> +\tindex) unpack_limit=1 ;;\n> +\tunpack) unpack_limit=10000 ;;\n> +\tesac\n\nNice, this is pretty self-explanatory.\n\n> +\ttest_expect_success 'prepare destination repository' '\n> +\t\trm -fr dest &&\n> +\t\tgit --bare init dest\n> +\t'\n> +\n> +\ttest_expect_success \"set unpacklimit to $unpack_limit\" '\n> +\t\tgit --git-dir=dest config receive.unpacklimit \"$unpack_limit\"\n> +\t'\n> +\n> +\ttest_expect_success 'setting receive.maxInputSize to 512 rejects push' '\n> +\t\tgit --git-dir=dest config receive.maxInputSize 512 &&\n> +\t\ttest_must_fail git push dest HEAD\n> +\t'\n> +\n> +\ttest_expect_success 'bumping limit to 4k allows push' '\n> +\t\tgit --git-dir=dest config receive.maxInputSize 4k &&\n> +\t\tgit push dest HEAD\n> +\t'\n\nMakes sense. We couldn't push, and then we could.\n\n> +\ttest_expect_success 'prepare destination repository (again)' '\n> +\t\trm -fr dest &&\n> +\t\tgit --bare init dest\n> +\t'\n> +\n> +\ttest_expect_success 'lifting the limit allows push' '\n> +\t\tgit --git-dir=dest config receive.maxInputSize 0 &&\n> +\t\tgit push dest HEAD\n> +\t'\n\nThis is new in this iteration, I think. At first I thought \"but every\n_other_ test script is implicitly testing that we work without the\nlimit\". But this is showing that setting the limit explicitly to 0 does\nwork, which is good.\n\nThe whole series looks fine to me.\n\n-Peff\n"},{"id":"300108","messageId":"xmqqoa4iotg9.fsf@gitster.mtv.corp.google.com","threadId":"43926","inReplyTo":"20160824184157.19264-1-chriscool@tuxfamily.org","subject":"Re: [PATCH v3 0/3] limit the size of the packs we receive","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-24T19:30:46Z","receivedAt":"2016-08-24T19:30:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> Diff with previous v2 version\n> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index f5b6061..8a115b3 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -2517,10 +2517,11 @@ receive.unpackLimit::\n>  \tespecially on slow filesystems.  If not set, the value of\n>  \t`transfer.unpackLimit` is used instead.\n>  \n> -receive.maxsize::\n> -\tIf the size of a pack file is larger than this limit, then\n> -\tgit-receive-pack will error out, instead of accepting the pack\n> -\tfile. If not set or set to 0, then the size is unlimited.\n> +receive.maxInputSize::\n> +\tIf the size of the incoming pack stream is larger than this\n> +\tlimit, then git-receive-pack will error out, instead of\n> +\taccepting the pack file. If not set or set to 0, then the size\n> +\tis unlimited.\n>  \n>  receive.denyDeletes::\n>  \tIf set to true, git-receive-pack will deny a ref update that deletes\n> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\n> ...\n> diff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh\n> new file mode 100755\n> index 0000000..10cb0be\n> --- /dev/null\n> +++ b/t/t5546-receive-limits.sh\n> @@ -0,0 +1,55 @@\n> +#!/bin/sh\n> + ...\n> +test_done\n> ---\n>\n> Christian Couder (1):\n>   unpack-objects: add --max-input-size=<size> option\n>\n> Jeff King (2):\n>   index-pack: add --max-input-size=<size> option\n>   receive-pack: allow a maximum input size to be specified\n\nThis was a pleasant read.  All looked sensible.\n\nThanks.\n"}]}