From 1556edfc75f48fcc08a7cedf4282b1139efd30d7 Mon Sep 17 00:00:00 2001 From: "Paul H. Hargrove" Date: Mon, 17 Jun 2024 16:26:13 -0700 Subject: [PATCH 1/2] Address bug 4723 in which ssh-spawner chokes tcsh In bug 4723 it has been observed that newlines in environment variables named in a `-E VAR` argument to ssh-spawner lead to errors from `tcsh` when it is the user's login shell. Follow-up tests show that non-conforming variable names used by `bash` to export shell functions are also an independent source of `tcsh` syntax errors. Lacking any known (to us) portable means to quote a newline in the `env VAR='VAL'` command used to implement `-E`, this commit instead performs some filtering in the construction of the `env` command to prevent the reported errors from arising. 1. Omit propagation of any value containing a newline. This addresses the reported `Unmatched '.` errors from `tcsh`. 2. Omit propagation of any variable with a non-conforming name. This addresses `Badly placed ()'s.` errors which occur when `tcsh` is parsing something like `env BASH_FUNC_module()=[...]` even when the `[...]` does not contain any newlines. Note that this "addresses" the issue reported in Bug 4723, but does *not* "resolve" it. IMO, true resolution would support propagation of environment variables (with conforming names) which contain newlines in their value. Cherry-picked from: gasnet:76c8a6a39 Signed-off-by: bonachea --- third-party/gasnet/gasnet-src/other/spawner/gasnetrun.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/third-party/gasnet/gasnet-src/other/spawner/gasnetrun.pl b/third-party/gasnet/gasnet-src/other/spawner/gasnetrun.pl index f7ad4f49d6ae..e97d4d285355 100644 --- a/third-party/gasnet/gasnet-src/other/spawner/gasnetrun.pl +++ b/third-party/gasnet/gasnet-src/other/spawner/gasnetrun.pl @@ -192,6 +192,11 @@ ($) # Implement -E for ssh, if required, as a wrapper (processed below) if (($spawner eq 'SSH') && defined $envlist) { foreach (split(',', $envlist)) { + # Screen both variable names and values for "bad" ones. + # See Bug 4723 for the motivation. + next if ($ENV{$_} =~ m/\n/); # skip value with newline(s), which we cannot portably quote + next unless ($_ =~ m/^[A-Za-z_][A-Za-z0-9_]*$/); # skip invalid variable name + unshift @ARGV, "$_=$ENV{$_}"; } unshift @ARGV, $ENV{'GASNET_ENVCMD'}; From f6aebc5918e15ca03f9338fb779f46b62c720635 Mon Sep 17 00:00:00 2001 From: bonachea Date: Tue, 18 Jun 2024 02:13:50 +0000 Subject: [PATCH 2/2] Update third-party/gasnet/README Signed-off-by: bonachea --- third-party/gasnet/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/gasnet/README b/third-party/gasnet/README index ee121bbd737d..2aaa006806b2 100644 --- a/third-party/gasnet/README +++ b/third-party/gasnet/README @@ -34,4 +34,4 @@ Chapel modifications to GASNet The modifications that we have made to the official GASNet release are as follows: -* None +* Cherry-picked 76c8a6a39 - Address bug 4723 in which ssh-spawner chokes tcsh