guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header


From: Arun Isaac
Subject: [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header
Date: Mon, 17 Jul 2023 23:14:15 +0100

Hi Maxim,

> nitpick: I guess these should be called 'procedures', which seems to be
> the preferred term in Scheme (ironically enough for a functional
> language?  eh!).  CC'ing Ludovic in case they have some thoughts on the
> matter, as I think they were the one originally teaching me that.
>
> If that was just me, intuitively I'd use 'procedure' for something
> involving side effects while 'function' as something taking an input and
> always returning the same output, without side effects (pure function),
> but that doesn't seem to be the prevalent style in the Scheme
> community.

Exactly, that was my intuition too. Maybe, we should break with
tradition! :-) In any case, I have changed all instances of "function"
to "procedure".

>> +            git-send-email-headers
>> +            compose))
>
> I think you've exported 'compose' erroneously here.

Good catch! compose is part of a new "mumi compose" feature I am working
on. I had accidentally committed it. I have removed it from this commit.

Now that you mention it, maybe I should call it compose-email so as to
not conflict with compose from guile core.

>> +(define (git-send-email-headers patch)
>> +  "Print send-email headers for PATCH."
>> +  (let* (;; Compute headers if configured in git config.
>> +         (header-command
>> +          (guard (ex (#t #f))
>> +            (call-with-input-pipe* (list "git" "config" 
>> "sendemail.headerCmd")
>> +              get-line)))
>
> Ain't this guard equivalent to '(false-if-exception
> (call-with-input-pipe* ...))' ? I find the later more readable if yes,

Good point! I was not aware of false-if-exception. I have changed to
using it now.

> but: does call-with-input-pipe* raise an exception when git is available
> but 'sendemail.headerCmd' not set, thus exiting with status 1?  I wasn't
> able to find its documentation in the Guile Reference manual.

call-with-input-pipe* and call-with-input-pipe are both defined in
mumi/client.scm. They are not part of guile. The only difference between
them is whether they accept the command as a string or as a list of
arguments---thus, they parallel open-pipe and open-pipe*.

> Otherwise you'd get header-command set to the empty string, which
> seems like it'd be a problem...

call-with-input-pipe* does raise an exception when git is available but
sendemail.headerCmd is not set. I checked. So, this is not a problem.

>> +         (headers
>> +          (if header-command
>> +              (call-with-input-pipe (string-append header-command " " patch)
>
>                   ^ ... here.  Also, why the mixed use of
>                   'call-with-input-pipe*' and 'call-with-input-pipe'?  I'd
>                   stick with the former.

sendemail.headerCmd is only available to us as a string, and not as a
list of arguments. It is quite non-trivial to correctly split the string
back into a list of arguments. That would require correct handling of
quotes like the shell does. So, we use call-with-input-pipe to handle
this case.

But everywhere else (such as when invoking "git config
sendemail.headerCmd"), we prefer to pass commands as a list of
arguments. So, we need call-with-input-pipe*.

I understand it's a bit confusing to have two very similar
functions. But, the only possible compromise is to use
call-with-input-pipe everywhere. Should I make that compromise? WDYT?

Thanks for the review!

Regards,
Arun





reply via email to

[Prev in Thread] Current Thread [Next in Thread]