From: "Rubén Justo" <rjusto@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: phillip.wood@dunelm.org.uk, Kyle Lippincott <spectral@google.com>,
Git List <git@vger.kernel.org>, Dragan Simic <dsimic@manjaro.org>,
Jeff King <peff@peff.net>
Subject: Re: Re* [PATCH v3 4/4] add-patch: render hunks through the pager
Date: Tue, 23 Jul 2024 00:00:10 +0200 [thread overview]
Message-ID: <0385c0cc-fb3e-4d12-9655-a409aea22c38@gmail.com> (raw)
In-Reply-To: <xmqqbk2p9lwi.fsf_-_@gitster.g>
On Mon, Jul 22, 2024 at 02:06:37PM -0700, Junio C Hamano wrote:
> So we have an answer:
>
> https://github.com/git/git/actions/runs/10047627546/job/27769808515
>
> tells us that the problematic shell is used in the job.
>
> It is
>
> ii dash 0.5.10.2-6 amd64 POSIX-compliant shell
>
> running on Ubuntu 20.04 that is "too POSIXly correct"[*] and behaves
> differently from what the tests expect.
>
> Somebody should write this combination down somewhere in the
> documentation so that we can answer (better yet, we do not have to
> answer) when somebody wonders if we know of a version of shell that
> refuses to do an one-shot export for shell functions as we naïvely
> expect.
>
>
> [Reference]
>
> * https://lore.kernel.org/git/4B5027B8.2090507@viscovery.net/
>
>
> ----- >8 --------- >8 --------- >8 --------- >8 ----
> CodingGuidelines: give an example shell that "fails" "VAR=VAL shell_func"
>
> Over the years, we accumulated the community wisdom to avoid the
> common "one-short export" construct for shell functions, but seem to
> have lost on which exact platform it is known to fail. Now during
> an investigation on a breakage for a recent topic, let's document
> one example of failing shell.
>
> This does *not* mean that we can freely start using the construct
> once Ubuntu 20.04 is retired. But it does mean that we cannot use
> the construct until Ubuntu 20.04 is fully retired from the machines
> that matter.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> Documentation/CodingGuidelines | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git c/Documentation/CodingGuidelines w/Documentation/CodingGuidelines
> index 1d92b2da03..a3ecb4ac5a 100644
> --- c/Documentation/CodingGuidelines
> +++ w/Documentation/CodingGuidelines
> @@ -204,6 +204,29 @@ For shell scripts specifically (not exhaustive):
> local variable="$value"
> local variable="$(command args)"
>
> + - The common construct
> +
> + VAR=VAL command args
> +
> + to temporarily set and export environment variable VAR only while
> + "command args" is running is handy, but some versions of dash (like
> + 0.5.10.2-6 found on Ubuntu 20.04) makes a temporary assignment
> + without exporting the variable, when command is *not* an external
> + command. We often have to resort to subshell with explicit export,
> + i.e.
> +
> + (incorrect)
> + VAR=VAL func args
> +
> + (correct)
> + (
> + VAR=VAL && export VAR &&
> + func args
Just a small comment; maybe it's worth adding an extra line to make the
example clearer:
VAR=VAL &&
export VAR &&
func args
> + )
> +
> + but be careful that the effect "func" makes to the variables in the
> + current shell will be lost across the subshell boundary.
> +
> - Use octal escape sequences (e.g. "\302\242"), not hexadecimal (e.g.
> "\xc2\xa2") in printf format strings, since hexadecimal escape
> sequences are not portable.
Thank you for digging into the test to find an explanation and for
adding the comment to the documentation.
next prev parent reply other threads:[~2024-07-22 22:00 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 0:57 [PATCH 0/4] use the pager in 'add -p' Rubén Justo
2024-07-12 1:00 ` [PATCH 1/4] add-patch: test for 'p' command Rubén Justo
2024-07-12 1:00 ` [PATCH 2/4] pager: do not close fd 2 unnecessarily Rubén Justo
2024-07-12 1:00 ` [PATCH 3/4] pager: introduce wait_for_pager Rubén Justo
2024-07-12 13:17 ` Phillip Wood
2024-07-12 1:00 ` [PATCH 4/4] add-patch: render hunks through the pager Rubén Justo
2024-07-12 8:58 ` Dragan Simic
2024-07-12 13:26 ` Phillip Wood
2024-07-12 16:24 ` Rubén Justo
2024-07-13 3:23 ` Rubén Justo
2024-07-13 9:12 ` Junio C Hamano
2024-07-13 13:17 ` phillip.wood123
2024-07-13 23:13 ` Rubén Justo
2024-07-12 8:56 ` [PATCH 0/4] use the pager in 'add -p' Dragan Simic
2024-07-13 16:26 ` [PATCH v2 " Rubén Justo
2024-07-13 16:29 ` [PATCH v2 1/4] add-patch: test for 'p' command Rubén Justo
2024-07-13 16:29 ` [PATCH v2 2/4] pager: do not close fd 2 unnecessarily Rubén Justo
2024-07-13 16:29 ` [PATCH v2 3/4] pager: introduce wait_for_pager Rubén Justo
2024-07-13 16:30 ` [PATCH v2 4/4] add-patch: render hunks through the pager Rubén Justo
2024-07-13 17:08 ` [PATCH v2 0/4] use the pager in 'add -p' Junio C Hamano
2024-07-13 23:21 ` Rubén Justo
2024-07-14 1:18 ` Junio C Hamano
2024-07-14 16:00 ` [PATCH v3 " Rubén Justo
2024-07-14 16:04 ` [PATCH v3 1/4] add-patch: test for 'p' command Rubén Justo
2024-07-14 16:04 ` [PATCH v3 2/4] pager: do not close fd 2 unnecessarily Rubén Justo
2024-07-14 16:04 ` [PATCH v3 4/4] add-patch: render hunks through the pager Rubén Justo
2024-07-15 14:10 ` Phillip Wood
2024-07-15 23:54 ` Junio C Hamano
2024-07-17 17:20 ` Rubén Justo
2024-07-17 19:39 ` phillip.wood123
2024-07-17 20:03 ` Junio C Hamano
2024-07-17 20:09 ` Eric Sunshine
2024-07-17 20:21 ` Junio C Hamano
2024-07-20 22:37 ` Rubén Justo
2024-07-22 7:18 ` Eric Sunshine
2024-07-22 14:53 ` Rubén Justo
2024-07-18 9:48 ` phillip.wood123
2024-07-17 20:31 ` Junio C Hamano
2024-07-18 9:56 ` phillip.wood123
2024-07-20 22:39 ` Rubén Justo
2024-07-20 22:29 ` Rubén Justo
2024-07-22 10:18 ` Phillip Wood
2024-07-22 16:45 ` Rubén Justo
2024-07-22 17:22 ` Junio C Hamano
2024-07-22 19:06 ` Rubén Justo
2024-07-22 19:27 ` Junio C Hamano
2024-07-22 21:06 ` Re* " Junio C Hamano
2024-07-22 22:00 ` Rubén Justo [this message]
2024-07-22 23:12 ` Kyle Lippincott
2024-07-22 23:28 ` Junio C Hamano
2024-07-23 2:31 ` Junio C Hamano
2024-07-22 21:25 ` Junio C Hamano
2024-07-22 23:20 ` Rubén Justo
2024-07-22 23:24 ` [PATCH 1/2] t3701: avoid one-shot export for shell functions Rubén Justo
2024-07-22 23:44 ` Junio C Hamano
2024-07-22 23:57 ` Junio C Hamano
2024-07-22 23:24 ` [PATCH 2/2] pager: make wait_for_pager a no-op for "cat" Rubén Justo
2024-07-22 23:54 ` Junio C Hamano
2024-07-18 9:58 ` [PATCH v3 4/4] add-patch: render hunks through the pager phillip.wood123
2024-07-20 22:45 ` Rubén Justo
2024-07-14 16:04 ` [PATCH v3 3/4] pager: introduce wait_for_pager Rubén Justo
2024-07-15 14:13 ` Phillip Wood
2024-07-15 20:04 ` Rubén Justo
2024-07-17 14:58 ` phillip.wood123
2024-07-15 20:16 ` [PATCH v4 0/4] add-patch: render hunks through the pager Rubén Justo
2024-07-15 20:20 ` [PATCH v4 1/4] add-patch: test for 'p' command Rubén Justo
2024-07-15 20:21 ` [PATCH v4 2/4] pager: do not close fd 2 unnecessarily Rubén Justo
2024-07-15 20:21 ` [PATCH v4 3/4] pager: introduce wait_for_pager Rubén Justo
2024-07-15 20:22 ` [PATCH v4 4/4] add-patch: render hunks through the pager Rubén Justo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0385c0cc-fb3e-4d12-9655-a409aea22c38@gmail.com \
--to=rjusto@gmail.com \
--cc=dsimic@manjaro.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=spectral@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).