{"thread":{"id":"54750","subject":"[PATCH] upload-pack: propagate return value from object filter config callback","startedAt":"2020-12-03T08:10:41Z","lastAt":"2020-12-03T08:10:41Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"411211","messageId":"X8idRpUCgV8rNeA6@coredump.intra.peff.net","threadId":"54750","inReplyTo":null,"subject":"[PATCH] upload-pack: propagate return value from object filter config callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-12-03T08:09:42Z","receivedAt":"2020-12-03T08:10:41Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"If we encounter an error in parse_filter_object_config(), we'll complain\nto stderr but won't actually propagate the return value up the stack.\nThis is unlike most of our config callbacks, which return the error to\ngit_config() so it can die (this includes the call just below us to\nparse_hide_refs_config(), which can also produce errors).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThe changed code is from 6dd3456a8c (upload-pack.c: allow banning\ncertain object filter(s), 2020-08-03), but it was not until 5b01a4e8ff\n(upload-pack.c: introduce 'uploadpackfilter.tree.maxDepth', 2020-08-03)\nthat the function could actually return an error (and so the test\ndoesn't work until then). Applying on top of tb/upload-pack-filters is\nreasonable.\n\n t/t5616-partial-clone.sh | 8 ++++++++\n upload-pack.c            | 3 ++-\n 2 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh\nindex f4d49d8335..2ea66205cf 100755\n--- a/t/t5616-partial-clone.sh\n+++ b/t/t5616-partial-clone.sh\n@@ -251,6 +251,14 @@ test_expect_success 'implicitly construct combine: filter with repeated flags' '\n \ttest_cmp unique_types.expected unique_types.actual\n '\n \n+test_expect_success 'upload-pack complains of bogus filter config' '\n+\tprintf 0000 |\n+\ttest_must_fail git \\\n+\t\t-c uploadpackfilter.tree.maxdepth \\\n+\t\tupload-pack . >/dev/null 2>err &&\n+\ttest_i18ngrep \"unable to parse.*tree.maxdepth\" err\n+'\n+\n test_expect_success 'upload-pack fails banned object filters' '\n \ttest_config -C srv.bare uploadpackfilter.blob:none.allow false &&\n \ttest_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \\\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5dc8e1f844..57a22d14f2 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1307,7 +1307,8 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)\n \t\t\treturn git_config_string(&data->pack_objects_hook, var, value);\n \t}\n \n-\tparse_object_filter_config(var, value, data);\n+\tif (parse_object_filter_config(var, value, data) < 0)\n+\t\treturn -1;\n \n \treturn parse_hide_refs_config(var, value, \"uploadpack\");\n }\n-- \n2.29.2.896.g080220a959\n"}]}