From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SCK7JW1XRWRCNwEASxT56A (envelope-from ) for ; Sun, 23 Apr 2023 18:06:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wHaAJW1XRWT6TQEAauVa8A (envelope-from ) for ; Sun, 23 Apr 2023 18:06:05 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 467554159 for ; Sun, 23 Apr 2023 18:06:05 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqcDR-00066S-Rk; Sun, 23 Apr 2023 12:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqcD3-00061z-1x for bug-guix@gnu.org; Sun, 23 Apr 2023 12:05:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqcD2-0002MN-NO for bug-guix@gnu.org; Sun, 23 Apr 2023 12:05:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqcD2-0004iW-8y for bug-guix@gnu.org; Sun, 23 Apr 2023 12:05:04 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#58813: [PATCH 1/5] gnu: git: Apply patch adding the --header-cmd feature. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 23 Apr 2023 16:05:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58813 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 58813@debbugs.gnu.org Cc: ludo@gnu.org, liliana.prikler@gmail.com, Maxim Cournoyer , zimon.toutoune@gmail.com Received: via spool by 58813-submit@debbugs.gnu.org id=B58813.168226588618062 (code B ref 58813); Sun, 23 Apr 2023 16:05:04 +0000 Received: (at 58813) by debbugs.gnu.org; 23 Apr 2023 16:04:46 +0000 Received: from localhost ([127.0.0.1]:46818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqcCj-0004h9-W8 for submit@debbugs.gnu.org; Sun, 23 Apr 2023 12:04:46 -0400 Received: from mail-qt1-f177.google.com ([209.85.160.177]:59902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqcCV-0004fl-Hu for 58813@debbugs.gnu.org; Sun, 23 Apr 2023 12:04:37 -0400 Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-3f0596e2c00so1482091cf.3 for <58813@debbugs.gnu.org>; Sun, 23 Apr 2023 09:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682265866; x=1684857866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3/nTDL5epv8LH7Zhp/PfgpNw44gpnaIU3KvJ9LYeRzs=; b=mk9Hi7c0WE/P2GN+WrmBVKgDF6HUS8CKADukuGo1GkgshYycutX6KrZNZoN6bYNXeJ nfCjMsFPmANs6yo3SWnSwMKxv8rTP17nTndI0Eh0AVXblz4FcbNmdUPu0ww7SbpfYp7N kS3LnrO5NWqTxPEOQ/+lLuzXzo9NQ00TTEWak33BciTKVce7WRcRJ/TchUohKHNgOVPU c7ooUiRHB7M8mCiy0MPFPZSENiCjwSkNPZzc7ufknL0APDfmM6ts00EAqQFWhrqba+7b 061y2HDYlQi0R0U87eWSaQqDXr5jc1DZEBHCSRBe8DMvjOV2cOb6tM/a+x9lCscsH8qd n9nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682265866; x=1684857866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3/nTDL5epv8LH7Zhp/PfgpNw44gpnaIU3KvJ9LYeRzs=; b=bAhLnuYXbyAtbw+f2/4qcigwEGXh7FzeVFQAanXPCm0D9LRNhlj89biWqqBXfwsHPd TtsepZl5oulugKn1emt4R7ZErtetv+gawRaWwEBhvkHFcAaqgaAbFA6n3NQrW39H+cnI 8SnLlOFfuhibAlB4PPhTMdDR0Lw3XNEGrrhjvxCRegKF3QMx1JFHvkWLSaBqpCUMaV2H JrEcHEe/t3fkrT7KPBxhxDPuFN5hPu4q9HQwUySUuXBLC1PRstJDfKM3ScQL0YmZnnV2 x5Jc3foPLj6irwoo0kJ9Q0TLAzgSgjGztFcM3zbirkEYPOyCrd4pG3cnSNwZS3Zygkyo +vnw== X-Gm-Message-State: AAQBX9fYlTlmHkf32yvok7M43UcHJ2VZ48TIBlO7iXLXz3dKzeswQ4h+ F9WWgsRj0d/+ev4eb5IpSsP54u2EhuT6+g== X-Google-Smtp-Source: AKy350akq3PpdFRKEl+nLbhYnesDjpW6YmGpi1NvQp4ZNGzTHcnnmY4FIeRTmGlTsloEKbXk1/bzdA== X-Received: by 2002:ac8:5cd1:0:b0:3ef:231c:cee7 with SMTP id s17-20020ac85cd1000000b003ef231ccee7mr19893101qta.7.1682265865755; Sun, 23 Apr 2023 09:04:25 -0700 (PDT) Received: from localhost.localdomain (dsl-141-20.b2b2c.ca. [66.158.141.20]) by smtp.gmail.com with ESMTPSA id d13-20020a05622a15cd00b003ef48392649sm2957469qty.4.2023.04.23.09.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 09:04:25 -0700 (PDT) From: Maxim Cournoyer Date: Sun, 23 Apr 2023 12:04:11 -0400 Message-Id: <2899162d279cdd940bc91459b38ff1e2c3f4f0ec.1682265703.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <878rg4snrf.fsf@gmail.com> References: <878rg4snrf.fsf@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682265965; a=rsa-sha256; cv=none; b=GxUCDl4RUxjGM9UfDwr0DPbdGIPhXN9eyIyvA6tzAwnX795Nn/O+RFlkYQulAGXbVFH8z+ s9J/tFCBMp9PDQwVJQLeQscOsNZqbjB3w3RTTS5/t427iw1YqUaztgNQCYrufL8ifGWF1u EssQsOBWVrb7Ilt5K1FA1eIN46niozdl6aB2yYvudRvrpKDSctqx+J2zutXircMCc8X1ZH O0/Mvbict0wJ/e8eeRCi9u7t8uEzgFzBGynSxU5ewowMFNsG2XagXIxXL7UL1oUYwcGOWD O2UbeCXCyiXUe+UFXef4CWl8ip8cxthBO9UvdXBJWQJnYxyuQF4viZKAFjOQhA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=mk9Hi7c0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682265965; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3/nTDL5epv8LH7Zhp/PfgpNw44gpnaIU3KvJ9LYeRzs=; b=AwLmP5sBcpo6BkHjRafGnuMwKvP5UU0qlrKXnu0C784TlFfoklkOElEI3ffPAcdYOKwVNH EidlYfY6CMcZHbr34A+NipKRiL9WKeM0Q7c12ElHSoMohhreRTMlEJ3BvspJJuDM0pzCSm Uzw+3DEDxa6ZcVNcuZ2RnP2Xi36qEpGguxI5D3pmKi3sB2WMkuq8yrH7rjEWq1vXnE91ZP +VKw9IDKw/VuXtVDWQ2CnzNJAHBpMfLKLugjPZa4iVpS1dgwsUu3gB5zoTGMq2e8tUxuY0 1WtnP/JkFif3xc64JzvlJ0bC+KQyzjQZETygcRZVIPX/iyKFQrQABVm0eF/Btg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=mk9Hi7c0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.79 X-Spam-Score: 7.79 X-Migadu-Queue-Id: 467554159 X-TUID: AN6SqdAXI8UE In preparation to fix . * gnu/packages/patches/git-header-cmd.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/version-control.scm (git) [source]: Apply patch. --- gnu/local.mk | 1 + gnu/packages/patches/git-header-cmd.patch | 180 ++++++++++++++++++++++ gnu/packages/version-control.scm | 3 +- 3 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/git-header-cmd.patch diff --git a/gnu/local.mk b/gnu/local.mk index b631fa6d5a..d7c7ca48e7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1209,6 +1209,7 @@ dist_patch_DATA = \ %D%/packages/patches/gemmi-fix-sajson-types.patch \ %D%/packages/patches/genimage-mke2fs-test.patch \ %D%/packages/patches/geoclue-config.patch \ + %D%/packages/patches/git-header-cmd.patch \ %D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch \ %D%/packages/patches/ghc-9.2-glibc-2.33-link-order.patch \ %D%/packages/patches/ghc-testsuite-dlopen-pie.patch \ diff --git a/gnu/packages/patches/git-header-cmd.patch b/gnu/packages/patches/git-header-cmd.patch new file mode 100644 index 0000000000..fdd34fe4a4 --- /dev/null +++ b/gnu/packages/patches/git-header-cmd.patch @@ -0,0 +1,180 @@ +Add a '--header-cmd' to git send-email. + +Upstream status can be tracked at: +https://lore.kernel.org/git/20230423122744.4865-1-maxim.cournoyer@gmail.com/T/#t + +diff --git a/Documentation/config/sendemail.txt b/Documentation/config/sendemail.txt +index 51da7088a8..3d0f516520 100644 +--- a/Documentation/config/sendemail.txt ++++ b/Documentation/config/sendemail.txt +@@ -58,6 +58,7 @@ sendemail.annotate:: + sendemail.bcc:: + sendemail.cc:: + sendemail.ccCmd:: ++sendemail.headerCmd:: + sendemail.chainReplyTo:: + sendemail.envelopeSender:: + sendemail.from:: +diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt +index b0f438ec99..354c0d06db 100644 +--- a/Documentation/git-send-email.txt ++++ b/Documentation/git-send-email.txt +@@ -320,6 +320,11 @@ Automating + Output of this command must be single email address per line. + Default is the value of `sendemail.ccCmd` configuration value. + ++--header-cmd=:: ++ Specify a command to execute once per patch file which should ++ generate arbitrary, patch file specific header entries. ++ Default is the value of `sendemail.headerCmd` configuration value. ++ + --[no-]chain-reply-to:: + If this is set, each email will be sent as a reply to the previous + email sent. If disabled with "--no-chain-reply-to", all emails after +diff --git a/git-send-email.perl b/git-send-email.perl +index fd8cd0d46f..676dd83d89 100755 +--- a/git-send-email.perl ++++ b/git-send-email.perl +@@ -2,6 +2,7 @@ + # + # Copyright 2002,2005 Greg Kroah-Hartman + # Copyright 2005 Ryan Anderson ++# Copyright 2023 Maxim Cournoyer + # + # GPL v2 (See COPYING) + # +@@ -87,8 +88,9 @@ sub usage { + + Automating: + --identity * Use the sendemail. options. +- --to-cmd * Email To: via ` \$patch_path` +- --cc-cmd * Email Cc: via ` \$patch_path` ++ --to-cmd * Email To: via ` \$patch_path`. ++ --cc-cmd * Email Cc: via ` \$patch_path`. ++ --header-cmd * Add headers via ` \$patch_path`. + --suppress-cc * author, self, sob, cc, cccmd, body, bodycc, misc-by, all. + --[no-]cc-cover * Email Cc: addresses in the cover letter. + --[no-]to-cover * Email To: addresses in the cover letter. +@@ -269,7 +271,7 @@ sub do_edit { + # Variables with corresponding config settings + my ($suppress_from, $signed_off_by_cc); + my ($cover_cc, $cover_to); +-my ($to_cmd, $cc_cmd); ++my ($to_cmd, $cc_cmd, $header_cmd); + my ($smtp_server, $smtp_server_port, @smtp_server_options); + my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path); + my ($batch_size, $relogin_delay); +@@ -318,6 +320,7 @@ sub do_edit { + "tocmd" => \$to_cmd, + "cc" => \@config_cc, + "cccmd" => \$cc_cmd, ++ "headercmd" => \$header_cmd, + "aliasfiletype" => \$aliasfiletype, + "bcc" => \@config_bcc, + "suppresscc" => \@suppress_cc, +@@ -519,6 +522,7 @@ sub config_regexp { + "compose" => \$compose, + "quiet" => \$quiet, + "cc-cmd=s" => \$cc_cmd, ++ "header-cmd=s" => \$header_cmd, + "suppress-from!" => \$suppress_from, + "no-suppress-from" => sub {$suppress_from = 0}, + "suppress-cc=s" => \@suppress_cc, +@@ -1776,6 +1780,9 @@ sub process_file { + push(@header, $_); + } + } ++ # Add computed headers, if applicable. ++ push @header, execute_cmd("header-cmd", $header_cmd, $t) ++ if defined $header_cmd; + # Now parse the header + foreach(@header) { + if (/^From /) { +@@ -2006,15 +2013,30 @@ sub process_file { + } + } + ++# Execute a command (e.g., $x_cmd) and return its output lines as an ++# array. ++sub execute_cmd { ++ my ($prefix, $cmd, $file) = @_; ++ my @lines = (); ++ open my $fh, "-|", "$cmd \Q$file\E" ++ or die sprintf(__("(%s) Could not execute '%s'"), $prefix, $cmd); ++ while (my $line = <$fh>) { ++ last if $line =~ /^$/; ++ push @lines, $line; ++ } ++ close $fh ++ or die sprintf(__("(%s) failed to close pipe to '%s'"), $prefix, $cmd); ++ return @lines; ++} ++ + # Execute a command (e.g. $to_cmd) to get a list of email addresses + # and return a results array + sub recipients_cmd { + my ($prefix, $what, $cmd, $file) = @_; +- ++ my @lines = (); + my @addresses = (); +- open my $fh, "-|", "$cmd \Q$file\E" +- or die sprintf(__("(%s) Could not execute '%s'"), $prefix, $cmd); +- while (my $address = <$fh>) { ++ @lines = execute_cmd($prefix, $cmd, $file); ++ for my $address (@lines) { + $address =~ s/^\s*//g; + $address =~ s/\s*$//g; + $address = sanitize_address($address); +@@ -2023,8 +2045,6 @@ sub recipients_cmd { + printf(__("(%s) Adding %s: %s from: '%s'\n"), + $prefix, $what, $address, $cmd) unless $quiet; + } +- close $fh +- or die sprintf(__("(%s) failed to close pipe to '%s'"), $prefix, $cmd); + return @addresses; + } + +diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh +index 0de83b5d2b..3393725107 100755 +--- a/t/t9001-send-email.sh ++++ b/t/t9001-send-email.sh +@@ -374,13 +374,16 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' + ) + ' + +-test_expect_success $PREREQ 'setup tocmd and cccmd scripts' ' ++test_expect_success $PREREQ 'setup cmd scripts' ' + write_script tocmd-sed <<-\EOF && + sed -n -e "s/^tocmd--//p" "$1" + EOF +- write_script cccmd-sed <<-\EOF ++ write_script cccmd-sed <<-\EOF && + sed -n -e "s/^cccmd--//p" "$1" + EOF ++ write_script headercmd-sed <<-\EOF ++ sed -n -e "s/^headercmd--//p" "$1" ++ EOF + ' + + test_expect_success $PREREQ 'tocmd works' ' +@@ -410,6 +413,20 @@ test_expect_success $PREREQ 'cccmd works' ' + grep "^ cccmd@example.com" msgtxt1 + ' + ++test_expect_success $PREREQ 'headercmd works' ' ++ clean_fake_sendmail && ++ cp $patches headercmd.patch && ++ echo "headercmd--X-Debbugs-CC: dummy@example.com" >>headercmd.patch && ++ git send-email \ ++ --from="Example " \ ++ --to=nobody@example.com \ ++ --header-cmd=./headercmd-sed \ ++ --smtp-server="$(pwd)/fake.sendmail" \ ++ headercmd.patch \ ++ && ++ grep "^X-Debbugs-CC: dummy@example.com" msgtxt1 ++' ++ + test_expect_success $PREREQ 'reject long lines' ' + z8=zzzzzzzz && + z64=$z8$z8$z8$z8$z8$z8$z8$z8 && diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm index 302f7c90ad..d5d88b99ed 100644 --- a/gnu/packages/version-control.scm +++ b/gnu/packages/version-control.scm @@ -232,7 +232,8 @@ (define-public git version ".tar.xz")) (sha256 (base32 - "1mpjvhyw8mv2q941xny4d0gw3mb6b4bqaqbh73jd8b1v6zqpaps7")))) + "1mpjvhyw8mv2q941xny4d0gw3mb6b4bqaqbh73jd8b1v6zqpaps7")) + (patches (search-patches "git-header-cmd.patch")))) (build-system gnu-build-system) (native-inputs `(("native-perl" ,perl) -- 2.39.2