unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: 67241@debbugs.gnu.org
Subject: bug#67241: [PATCH] guix-install.sh: Add message about Info reader.
Date: Thu, 19 Dec 2024 16:58:48 +0900	[thread overview]
Message-ID: <87frmkkssn.fsf@gmail.com> (raw)
In-Reply-To: <87ldwf7bml.fsf@gmail.com> (Simon Tournier's message of "Mon, 16 Dec 2024 18:58:58 +0100")

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi Maxim,
>
> On Mon, 16 Dec 2024 at 11:53, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>>> +_info()
>>> +{
>>> +    if [ "$(type -P info)" ]; then
>>> +        _msg "$1"
>>> +    else
>>> +        _msg "${WAR}Please install Info reader; see package 'info-reader'"
>>> +        _msg "$1"
>>> +    fi
>>> +}
>>
>> It seems odd to me to "overload" _msg into _info that deals with some side
>> effect; I'd rather see this conditional explicit at the message printing
>> site.
>
> It was to avoid the duplication of the exact same conditional with the
> exact same message.
>
> I do not have an opinion…

Hm.  I agree duplication is not nice.  Probably a naming issue ;-)

>> Also, your test is testing for the empty string when info is not found,
>> not the exist status, which is wrong.
>
> Please note that the script already uses:
>
>      if [ "$(type -P pidof)" ]; then
>          if [ ! "$(pidof nscd)" ]; then
>
> And I have only respected the same. :-)

According to git blame these lines were also authored by you 4 years
ago, ha!

>> not the exist status, which is wrong.  I think you meant something like:
>>
>> --8<---------------cut here---------------start------------->8---
>> if type -P info >/dev/null then [...]; fi
>> --8<---------------cut here---------------end--------------->8---
>
> Well, I am not a Bash expert but I guess that’s the same result in
> practise, no?

It checks the exit status instead of the captured string output.  While
it's not that bad in that case, in general I find checking for the exit
status a much more reliable and clean option.

> Both $() and "" used in tandem makes the test sound, from my
> understanding.

Hm.  Is [ "something" ] true and [ "" ] false?  Apparently it is, but
I'd argue that's not very clear, especially when there are explicit test
operations to check for an non-empty or empty string (test -n and test
-z).

>> But this got me curious again... could we instead automate the
>> installation of info post-installation?
>
> It appears to me unrelated to this change at hand. :-)

It's related in that if the user opted to install 'info-reader' (on by
default), we wouldn't have to warn anything about, but yes, we can do so
later if you prefer, as I expect it's not that trivial.

I don't have strong feelings about the change as-is anymore, but I may
refactor the type -P checks to use the alternative style outlined above,
if you don't mind.

-- 
Thanks,
Maxim




      reply	other threads:[~2024-12-19  8:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 10:38 bug#67241: guix-install.sh: Run ’info guix’ needs ’info’ Simon Tournier
2024-11-12  6:28 ` Maxim Cournoyer
2024-11-16  7:54   ` bug#67241: [PATCH] guix-install.sh: Add message about Info reader Simon Tournier
2024-12-16  2:53     ` Maxim Cournoyer
2024-12-16 17:58       ` Simon Tournier
2024-12-19  7:58         ` Maxim Cournoyer [this message]

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87frmkkssn.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=67241@debbugs.gnu.org \
    --cc=zimon.toutoune@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).