{"thread":{"id":"43878","subject":"[PATCH v2 3/3] receive-pack: allow a maximum input size to be specified","startedAt":"2016-08-18T13:16:49Z","lastAt":"2016-08-19T01:14:21Z","messageCount":7,"participants":["Christian Couder","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"299607","messageId":"20160818131553.22580-4-chriscool@tuxfamily.org","threadId":"43878","inReplyTo":"20160818131553.22580-1-chriscool@tuxfamily.org","subject":"[PATCH v2 3/3] receive-pack: allow a maximum input size to be specified","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-18T13:15:53Z","receivedAt":"2016-08-18T13:16:49Z","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           |  5 +++++\n Documentation/git-receive-pack.txt |  3 +++\n builtin/receive-pack.c             | 12 +++++++++++\n t/t5546-push-limits.sh             | 42 ++++++++++++++++++++++++++++++++++++++\n 4 files changed, 62 insertions(+)\n create mode 100755 t/t5546-push-limits.sh\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 0bcb679..f5b6061 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2517,6 +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+\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 92e1213..8c2943d 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.maxsize\") == 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@@ -1650,6 +1656,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@@ -1678,6 +1687,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-push-limits.sh b/t/t5546-push-limits.sh\nnew file mode 100755\nindex 0000000..09e958f\n--- /dev/null\n+++ b/t/t5546-push-limits.sh\n@@ -0,0 +1,42 @@\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\n-- \n2.10.0.rc0.3.geb1f4c9.dirty\n\n"},{"id":"299608","messageId":"20160818131553.22580-3-chriscool@tuxfamily.org","threadId":"43878","inReplyTo":"20160818131553.22580-1-chriscool@tuxfamily.org","subject":"[PATCH v2 2/3] unpack-objects: add --max-input-size=<size> option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-18T13:15:52Z","receivedAt":"2016-08-18T13:19:34Z","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.rc0.3.geb1f4c9.dirty\n\n"},{"id":"299609","messageId":"20160818131553.22580-1-chriscool@tuxfamily.org","threadId":"43878","inReplyTo":null,"subject":"[PATCH v2 0/3] limit the size of the packs we receive","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-18T13:15:50Z","receivedAt":"2016-08-18T13:19:39Z","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 v1 version\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n  - removed last sentences of the commit message in patch 3/3, as\n    suggested by Peff,\n\n  - improved the tests in the last patch, as suggested by Peff\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\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/\n\nPeff's initial patch is:\n\nhttps://public-inbox.org/git/20150612182045.GA23698%40peff.net/\n\nDiff with previous v1 version\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\ndiff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh\nindex b38d508..09e958f 100755\n--- a/t/t5546-push-limits.sh\n+++ b/t/t5546-push-limits.sh\n@@ -11,11 +11,11 @@ test_expect_success 'create remote repository' '\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\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 foo \"$filesize\" >\"$filename\" &&\n+\t\ttest-genrandom \"$seed\" \"$filesize\" >\"$filename\" &&\n \t\tgit add \"$filename\" &&\n \t\ttest_commit \"$filename\"\n \t'\n@@ -35,8 +35,8 @@ do\n \t'\n \n done <<\\EOF\n-1 1024 one-k-file\n-10 2048 two-k-file\n+1 1024 one-k-file foo\n+10 1024 other-one-k-file bar\n EOF\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             |  5 +++++\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-push-limits.sh               | 42 ++++++++++++++++++++++++++++++++++++\n 8 files changed, 79 insertions(+)\n create mode 100755 t/t5546-push-limits.sh\n\n-- \n2.10.0.rc0.3.geb1f4c9.dirty\n\n"},{"id":"299610","messageId":"20160818131553.22580-2-chriscool@tuxfamily.org","threadId":"43878","inReplyTo":"20160818131553.22580-1-chriscool@tuxfamily.org","subject":"[PATCH v2 1/3] index-pack: add --max-input-size=<size> option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-08-18T13:15:51Z","receivedAt":"2016-08-18T13:19:45Z","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.rc0.3.geb1f4c9.dirty\n\n"},{"id":"299611","messageId":"20160818134727.qqfsxpmek73dgi5h@sigill.intra.peff.net","threadId":"43878","inReplyTo":"20160818131553.22580-1-chriscool@tuxfamily.org","subject":"Re: [PATCH v2 0/3] limit the size of the packs we receive","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-18T13:47:27Z","receivedAt":"2016-08-18T13:47:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 18, 2016 at 03:15:50PM +0200, Christian Couder wrote:\n\n> Diff with previous v1 version\n> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n> \n> diff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh\n> index b38d508..09e958f 100755\n> --- a/t/t5546-push-limits.sh\n> +++ b/t/t5546-push-limits.sh\n> @@ -11,11 +11,11 @@ test_expect_success 'create remote repository' '\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\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 foo \"$filesize\" >\"$filename\" &&\n> +\t\ttest-genrandom \"$seed\" \"$filesize\" >\"$filename\" &&\n>  \t\tgit add \"$filename\" &&\n>  \t\ttest_commit \"$filename\"\n>  \t'\n> @@ -35,8 +35,8 @@ do\n>  \t'\n>  \n>  done <<\\EOF\n> -1 1024 one-k-file\n> -10 2048 two-k-file\n> +1 1024 one-k-file foo\n> +10 1024 other-one-k-file bar\n>  EOF\n>  \n>  test_done\n\nThis is still not quite what I would have written, but I don't think\nit's worth arguing over.\n\nThis version looks OK to me. Thanks.\n\n-Peff\n"},{"id":"299629","messageId":"xmqqpop56czc.fsf@gitster.mtv.corp.google.com","threadId":"43878","inReplyTo":"20160818131553.22580-4-chriscool@tuxfamily.org","subject":"Re: [PATCH v2 3/3] receive-pack: allow a maximum input size to be specified","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-18T20:25:43Z","receivedAt":"2016-08-19T01:11:07Z","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> From: Jeff King <peff@peff.net>\n>\n> Receive-pack feeds its input to either index-pack or\n> unpack-objects, which will happily accept as many bytes as\n> a sender is willing to provide. Let's allow an arbitrary\n> cutoff point where we will stop writing bytes to disk.\n>\n> Cleaning up what has already been written to disk is a\n> related problem that is not addressed by this patch.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n>  Documentation/config.txt           |  5 +++++\n>  Documentation/git-receive-pack.txt |  3 +++\n>  builtin/receive-pack.c             | 12 +++++++++++\n>  t/t5546-push-limits.sh             | 42 ++++++++++++++++++++++++++++++++++++++\n>  4 files changed, 62 insertions(+)\n>  create mode 100755 t/t5546-push-limits.sh\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index 0bcb679..f5b6061 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -2517,6 +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\nShouldn't this be maxInputSize, not just maxSize?  You are limiting\nthe size of the input, not the size of the resulting pack, right?\n\n> +\tIf the size of a pack file is larger than this limit, then\n\nSo, s/a pack file/the incoming pack stream/ or something?\n\n> diff --git a/t/t5546-push-limits.sh b/t/t5546-push-limits.sh\n> new file mode 100755\n> index 0000000..09e958f\n\nTechnically, that's receive-limits, no?  It is conceivable that the\nclient side can also grow a feature to limit the size of an outgoing\npush, but that is not what this new script is about.\n\n> --- /dev/null\n> +++ b/t/t5546-push-limits.sh\n> @@ -0,0 +1,42 @@\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\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\nI agree with Peff that these tests should push into an empty,\npristine destination.  Move the \"create remote\" step inside the\nwhile loop and prefix its \"git init\" with \"rm -rf dest\", or\nsomething like that.\n\nIt would make it crystal clear that the produced packstream for our\ntransfer won't ever be affected by what is leftover in the\ndestination repository.\n\nAlso, I think it would make it far more readable if you made the\nbody of the while loop into a helper function that runs tests,\nkeeping \"1/10 corresponds to index/unpack\" magic hidden inside the\nhelper, i.e. something like\n\ntest_pack_input_limit () {\n\tsize=$2\n        case \"$1\" in\n        unpack) unpack_limit=10000 ;;\n        index) unpack_limit=1 ;;\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.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\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.maxsize 0 &&\n\t\tgit push dest HEAD\n\t'\n}\n\nand have the body of the test more like this:\n\n\ttest_expect_success 'setup' '\n\t\ttest-genrandom foo 1024 >test-file &&\n\t\tgit add test-file &&\n\t\ttest_commit test-file\n\t'\n\n\ttest_pack_input_limit unpack 1024 \n\ttest_pack_input_limit index 1024 \n\nPerhaps?\n"},{"id":"299641","messageId":"20160818214331.ie7idv2m3ljgjzyg@sigill.intra.peff.net","threadId":"43878","inReplyTo":"xmqqpop56czc.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 3/3] receive-pack: allow a maximum input size to be specified","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-18T21:43:31Z","receivedAt":"2016-08-19T01:14:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 18, 2016 at 01:25:43PM -0700, Junio C Hamano wrote:\n\n> > diff --git a/Documentation/config.txt b/Documentation/config.txt\n> > index 0bcb679..f5b6061 100644\n> > --- a/Documentation/config.txt\n> > +++ b/Documentation/config.txt\n> > @@ -2517,6 +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> \n> Shouldn't this be maxInputSize, not just maxSize?  You are limiting\n> the size of the input, not the size of the resulting pack, right?\n\nYeah, that is probably a better name. I don't recall why I picked\nmaxSize long ago.\n\n> [...]\n\nI agree, too, with all of the other comments you made.\n\n-Peff\n"}]}