Subject: Re: can't substitute etc/teams.scm command as doc suggests

From: Liliana Marie Prikler <[email-masked]>
Date: Thu, 27 Oct 2022 18:27:51 +0200

Am Donnerstag, dem 27.10.2022 um 08:40 -0400 schrieb Maxim Cournoyer:
> Hi,
> 
> Liliana Marie Prikler <[email-masked]> writes:
> 
> > Am Mittwoch, dem 26.10.2022 um 23:50 -0400 schrieb Maxim Cournoyer:
> > > Hi,
> > > 
> > > Today, I tried;
> > > 
> > > --8<---------------cut here---------------start------------->8---
> > > $ git send-email --to=[email-masked] \
> > >   $(./etc/teams.scm cc-members origin/master HEAD) 0000-cover-
> > > letter.patch
> > > fatal: ambiguous argument [email-masked]"': unknown
> > > revision or path not in the working tree.
> > > Use '--' to separate paths from revisions, like this:
> > > 'git <command> [<revision>...] -- [<file>...]'
> > > format-patch -o /tmp/pFSRbRNNoU --add-header="X-Debbugs-Cc:
> > > [email-masked]" --add-header="X-Debbugs-Cc: redacted@email"
> > > [...]: command returned error: 128
> > > 
> > > $ ./etc/teams.scm cc-members origin/master HEAD
> > > --add-header="X-Debbugs-Cc: redacted@email" --add-header="X-
> > > Debbugs-
> > > Cc: redacted@email" ...
> > > --8<---------------cut here---------------end--------------->8---
> > > 
> > > You can see the command fails; this is because when using Bash
> > > command substitution $(), the quotes in the result are not
> > > interpreted and are thus part of the value (literals), which then
> > > gets split on white space.
> > > 
> > > As a quick hacky fix,  I tried removing the space and double
> > > quotes
> > > like:
> > > 
> > > modified   etc/teams.scm.in
> > > @@ -514,7 +514,7 @@ (define (cc . teams)
> > >    "Return arguments for `git send-email' to notify the members
> > > of
> > > the given
> > >  TEAMS when a patch is received by Debbugs."
> > >    (format #true
> > > -          "~{--add-header=\"X-Debbugs-Cc: ~a\"~^ ~}"
> > > +          "~{--add-header=X-Debbugs-Cc:~a~^ ~}"
> > >            (map person-email
> > >                 (delete-duplicates (append-map team-members
> > > teams)
> > > equal?))))
> > > 
> > > and sent a patch with that command:
> > > 
> > > git send-email --to=[email-masked] \
> > >   $(./etc/teams.scm cc-members origin/master HEAD 0000-cover-
> > > letter.patch
> > > 
> > > It created https://issues.guix.gnu.org/58812 with it, but I don't
> > > see
> > > any of the X-Debbugs-Cc headers.  Mmmh.
> > Note that the existing etc/teams also assumes there are no funny
> > characters in the quote.  So it's susceptible to good ol' bobby
> > tables.
> > 
> > Could we, instead of outputting a command, make it so that we can
> > pass
> > an already formatted patch and etc/teams rewrites it?
> 
> The solution suggested to me in #bash would be to turn etc/teams.scm
> into a git wrapper, that could invoke git with all the arguments at
> once (allowing people to pass arguments themselves).  I'm told the
> git completion could be hooked to such script so that users can still
> enjoy git tab-completion when using etc/teams.scm, although I haven't
> researched how that'd all work.
> 
> A similar idea proposed by selckin on #git would be to have our
> etc/teams.scm script receive the complete git command, and append the
> args to it itself (and invoke it), like so:
> 
> ./etc/teams.scm cc mentors -- git send-email --to
> [email-masked] *.patch
I think we should go with the former and implement a proper "guix send-
email" ;)