From patchwork Fri Jan 27 20:06:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 13119335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 234DFC54EAA for ; Fri, 27 Jan 2023 20:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbjA0UIB (ORCPT ); Fri, 27 Jan 2023 15:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbjA0UHe (ORCPT ); Fri, 27 Jan 2023 15:07:34 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA39519F09 for ; Fri, 27 Jan 2023 12:06:08 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id h12so5942669wrv.10 for ; Fri, 27 Jan 2023 12:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ybyG4yr7Hp3pvfK4uIlWp5IwyZK1wDJt0gkq+X8sedQ=; b=HbNogUgOv5UVyJGRZX8Yf0Rh7GxQ4B1vMf8iHAQFcm3jGYWvXG8oxTy5e6qkeRKAcf pLTnnfsjPQQTDqJa/WUv6b8g8oHPfz/SMQmuXISIZDeMbZ8DSFZQxS/lmyBaQuumC31F aaN7wdlPvKWoU9Ua+uEfSNqbNNe5IMIggLO5UnF6cQBVmKxceiMhzAlMXReMNATe0oH3 cmVloq6yWo9U62au2/juuxRRcK3sRfItpX0cO/rWU2BKdUc8RQN3z+Ce9MimjTVWafi4 a5gTIrlyyLhCULjJeBZPbVEgjEw5iPjJrCV671yi7nZ1ot2HblL4xEN6qojInp0Odb6f NCJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ybyG4yr7Hp3pvfK4uIlWp5IwyZK1wDJt0gkq+X8sedQ=; b=BdbhlZP9+/w3NwG3c7qGoOs1qWDnZbeS5FBErziZ2LUTMqqdaF97WJkepnmIpxYBJc u0xchM0q2/m+0EY2FBjFKdEMfkJ+tvfWLQ5R1jnPqFcuXd4Mv1kjC9eEAewjvszYfET6 sSBIcT9pmaFRoPkjgfNIeTCryRPYOEkIWVpQv/rEUuaOwV+MzQu97iSvJABD7bQ1itQY +Q7h+WPCVB8vKzu00D5PuT0jqKLTYEA69GjJ0GHLOUzs6QYz6HtJaau3u8XzC2yljcWf hzdWjDR9qzX0Ey5s7D/9tO1PZdbydwj0zjwiRPnyDqluDKnZ6L0YKUjlEmmF3NbFPaWJ 2mQA== X-Gm-Message-State: AFqh2krp+mL8CLCvnv/YZlmqfVTzwDHcojHfUKIgLB/lM1SQDrojYcI5 D5/eEXjH7EuQbHT+/3bw7r5aJZX2YWY= X-Google-Smtp-Source: AMrXdXtaaFDqOwn6GLxY3Q9CdK1xsfVuu4RAIdDJ4a6HRAW89hG9SGIN7bLSEOOE7nU4kXfq0s0CLg== X-Received: by 2002:a5d:6a46:0:b0:2bd:c856:6de0 with SMTP id t6-20020a5d6a46000000b002bdc8566de0mr38260600wrw.21.1674849965041; Fri, 27 Jan 2023 12:06:05 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n15-20020a5d67cf000000b002bdef155868sm4654033wrw.106.2023.01.27.12.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 12:06:04 -0800 (PST) Message-Id: <94630bc3bc7f4f236c28e791e0faba6590c735e8.1674849963.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 27 Jan 2023 20:06:01 +0000 Subject: [PATCH 1/3] t: allow 'scalar' in test_must_fail Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: vdye@github.com, gitster@pobox.com, Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee This will enable scalar tests to use the test_must_fail helper, when necessary. Signed-off-by: Derrick Stolee --- t/test-lib-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 79922227030..75b8ee95e7f 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1016,7 +1016,7 @@ test_must_fail_acceptable () { fi case "$1" in - git|__git*|test-tool|test_terminal) + git|__git*|scalar|test-tool|test_terminal) return 0 ;; *) From patchwork Fri Jan 27 20:06:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 13119334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EF22C61DA4 for ; Fri, 27 Jan 2023 20:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233446AbjA0UH7 (ORCPT ); Fri, 27 Jan 2023 15:07:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbjA0UHd (ORCPT ); Fri, 27 Jan 2023 15:07:33 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA52D1EBEA for ; Fri, 27 Jan 2023 12:06:08 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id k16so4205569wms.2 for ; Fri, 27 Jan 2023 12:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FIz5w1mSCRudVQy3sVj0CM5aMF3+UR1XyIRPn+Y+U2E=; b=H/J9Q74As2tdlQ3zrFin0VClNCTZyLeicbC7vuuNqkCWpfFh/+XozpDL8auKt5KE0t HAXMHyDA551cGLPm4Is7cBnzdW2vp3mfz3D+45cHjVnAfLZ50p+lqRPiJ8Q7SBv2di0g NgvzxEbrVD6o4reYKCzolBUKLydx0jcUWQgiPWJqbGJOyu+jr+izMqZNttSUOD5ykgAX 4KFdvV5MTz+FZ40g7O7w8MKcZMkE+pEGcElvv6X6epKoR2EWBXlfEJAFHv/Uy0C8PWGi bvAlXyLq+PddoTj9lGjtaZ9T9TNB7vvPQau4tD1AWMwKegAqS0Q+uq+BXssdhHvG7eEj /BgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FIz5w1mSCRudVQy3sVj0CM5aMF3+UR1XyIRPn+Y+U2E=; b=2AoAvFoZdPKCSh6uMG7S5p/5dTArEDRTAMh0m7EUjSlUfhPxyYmZ/3BamS9GQcj0vh k+osx8zV8vA9oVzBgWB3BG7y7oCVJh26HE9am9iCHOy12qhqWqo6qUpXyOXC9COeNeIU c5L4sD5au+bXnZeqMzWagtVmyxu4rdjkkPURSpAp/e7yszSJMKuA74vxXKzUdUQ22zO5 I1MzXAgKL5gXaS23/mHrgHWKwFyzRslxHi7hhdCp28OPbJESdD0ZKZCKpLmSN7ZV8RGl aGDU8/qntDr6Gq4YIpYgLyUeuxZab3KWyv5U9AdRB6MBjMHYx6XPuFJcpwYd1pyZWyy2 QdZg== X-Gm-Message-State: AFqh2krkSnomeLBzi0JcFhugjzZCEEFBVhOwUJ/RGx7UKhyJqypHTj+n AL331/0V5SW4JSxqzKW6+A5rBAqYVNk= X-Google-Smtp-Source: AMrXdXseSIynkKoTMxesRNHgSAoe0qGxYdJ4EqEg714PfrYXjnaK9cZqiPYLI6H4duVK3WuXrx2zTw== X-Received: by 2002:a05:600c:444b:b0:3da:fd06:a6f1 with SMTP id v11-20020a05600c444b00b003dafd06a6f1mr39459361wmn.31.1674849965791; Fri, 27 Jan 2023 12:06:05 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id hg6-20020a05600c538600b003dafbd859a6sm8669933wmb.43.2023.01.27.12.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 12:06:05 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 27 Jan 2023 20:06:02 +0000 Subject: [PATCH 2/3] t921*: test scalar behavior starting maintenance Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: vdye@github.com, gitster@pobox.com, Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee A user recently reported issues with 'scalar register' and 'scalar clone' in that they failed when the system had permissions locked down so both 'crontab' and 'systemctl' commands failed when trying to enable background maintenance. This hard error is undesirable, but let's create tests that demonstrate this behavior before modiying the behavior. We can use GIT_TEST_MAINT_SCHEDULER to guarantee failure and check the exit code and error message. Signed-off-by: Derrick Stolee --- t/t9210-scalar.sh | 7 +++++++ t/t9211-scalar-clone.sh | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh index 25f500cf682..13a4f6dbcf4 100755 --- a/t/t9210-scalar.sh +++ b/t/t9210-scalar.sh @@ -104,6 +104,13 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' ' test_cmp_config -C test/src true core.fsmonitor ' +test_expect_success 'scalar register fails when background maintenance fails' ' + git init register-repo && + GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \ + test_must_fail scalar register register-repo 2>err && + grep "could not turn on maintenance" err +' + test_expect_success 'scalar unregister' ' git init vanish/src && scalar register vanish/src && diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh index 02d32fb6ede..a6156da29ac 100755 --- a/t/t9211-scalar-clone.sh +++ b/t/t9211-scalar-clone.sh @@ -174,4 +174,10 @@ test_expect_success 'progress without tty' ' cleanup_clone $enlistment ' +test_expect_success 'scalar clone fails when background maintenance fails' ' + GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \ + test_must_fail scalar clone "file://$(pwd)/to-clone" maint-fail 2>err && + grep "could not turn on maintenance" err +' + test_done From patchwork Fri Jan 27 20:06:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 13119333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 989B3C38142 for ; Fri, 27 Jan 2023 20:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbjA0UH5 (ORCPT ); Fri, 27 Jan 2023 15:07:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233439AbjA0UHd (ORCPT ); Fri, 27 Jan 2023 15:07:33 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA78088F1B for ; Fri, 27 Jan 2023 12:06:09 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id h16so5923743wrz.12 for ; Fri, 27 Jan 2023 12:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=AfX3lc/XiAOcU9xX1dRHC4SL+HBuaAQND5EObLBEmac=; b=pOUpQGYVDUrW3P6na3RDsM7suH3MbeJhl0/bkrhDGJt4sTk7ws7Rxz+db0h5/27zon WTkf3VmqYe8Yt/AVEdP8ugnZx6ESEwoL0m4TLq7E2CSIX+Cpj89Yita0gp87llqhlpSC ++UcsTmfVSSsh83L/P54MAK7G+N2KlPMpchrT5lBoul1W038UOOzxz9JHWKJJg/XOKpL i93L/wV9SUKg4PRNYmz62X9Q/sIAoGpTJ2mjHlOkGd4WjwDlw5p26avMHM3s71T7mqYw I1IFfl8tl/4VNvsNsX3RnBCSYq0Q2V9FGGul0fBWuGXp6YaJXnlgd8pxFwXjs+cLU4Pq dlig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AfX3lc/XiAOcU9xX1dRHC4SL+HBuaAQND5EObLBEmac=; b=ZemvrwiioRwm7pABUdSPOVi/SFeLyl/xtATHof7G+wRETsoGpg/hEwOE3tV945u6s3 HYCldkV4NztIT7Echrrgu3dfWdkLWHpTLTIFOO1hYKBSpkLN1oFOSM6BuqAbSR9yZ30B xgMZMTciUrm0EIL4B4fW4d1KwCMR5Kj7mEQQkS9KqnB1G1oWCYUVOwFCZ3oGCTIKaVEf f9U8SJ3fQZET2Jo6iv8Q9tGJHZ4jiUmjazu8w36LQKE+Bjw7EIEw/Y619Cw1aglX9sg/ FN6l4Kc7NqvOnAzJ16n5ykIAsxTak26OZQKRaWr4dmet33/ZbBFgNWgRa6/VpRvtD2uG 99Pw== X-Gm-Message-State: AFqh2krhXk72wRRt7NYT35S0kLQF6PS26dQJMRwonMIj9V6IKI1ZUhys QAL7c2JuaUvP12Gu9uKDr7N3t9COgsc= X-Google-Smtp-Source: AMrXdXvZkGNx0X6v2j0mgRGyem8N5RHH6qc9uYBaZoQ3qG21cZ48xLydrz248iW0a7+HuPsv8W5OgQ== X-Received: by 2002:adf:b604:0:b0:242:1809:7e17 with SMTP id f4-20020adfb604000000b0024218097e17mr34399128wre.6.1674849966684; Fri, 27 Jan 2023 12:06:06 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m2-20020a056000180200b002bfb5618ee7sm4835144wrh.91.2023.01.27.12.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 12:06:06 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 27 Jan 2023 20:06:03 +0000 Subject: [PATCH 3/3] scalar: only warn when background maintenance fails Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: vdye@github.com, gitster@pobox.com, Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee A user reported issues with 'scalar clone' and 'scalar register' when working in an environment that had locked down the ability to run 'crontab' or 'systemctl' in that those commands registered as _failures_ instead of opportunistically reporting a success with just a warning about background maintenance. As a workaround, they can use GIT_TEST_MAINT_SCHEDULER to fake a successful background maintenance, but this is not a viable strategy for long-term. Update 'scalar register' and 'scalar clone' to no longer fail by modifying register_dir() to only warn when toggle_maintenance(1) fails. Since background maintenance is a "nice to have" and not a requirement for a working repository, it is best to move this from hard error to gentle warning. Signed-off-by: Derrick Stolee --- scalar.c | 2 +- t/t9210-scalar.sh | 4 ++-- t/t9211-scalar-clone.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scalar.c b/scalar.c index f25d5f1d0ef..ca19b95ce46 100644 --- a/scalar.c +++ b/scalar.c @@ -262,7 +262,7 @@ static int register_dir(void) return error(_("could not set recommended config")); if (toggle_maintenance(1)) - return error(_("could not turn on maintenance")); + warning(_("could not turn on maintenance")); if (have_fsmonitor_support() && start_fsmonitor_daemon()) { return error(_("could not start the FSMonitor daemon")); diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh index 13a4f6dbcf4..4432a30d10b 100755 --- a/t/t9210-scalar.sh +++ b/t/t9210-scalar.sh @@ -104,10 +104,10 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' ' test_cmp_config -C test/src true core.fsmonitor ' -test_expect_success 'scalar register fails when background maintenance fails' ' +test_expect_success 'scalar register warns when background maintenance fails' ' git init register-repo && GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \ - test_must_fail scalar register register-repo 2>err && + scalar register register-repo 2>err && grep "could not turn on maintenance" err ' diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh index a6156da29ac..872ad1c9c2b 100755 --- a/t/t9211-scalar-clone.sh +++ b/t/t9211-scalar-clone.sh @@ -174,9 +174,9 @@ test_expect_success 'progress without tty' ' cleanup_clone $enlistment ' -test_expect_success 'scalar clone fails when background maintenance fails' ' +test_expect_success 'scalar clone warns when background maintenance fails' ' GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \ - test_must_fail scalar clone "file://$(pwd)/to-clone" maint-fail 2>err && + scalar clone "file://$(pwd)/to-clone" maint-fail 2>err && grep "could not turn on maintenance" err '