[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dragora-members] Qi 2.0rc14
From: |
Michael Siegel |
Subject: |
Re: [Dragora-members] Qi 2.0rc14 |
Date: |
Fri, 31 Jul 2020 14:37:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Am 31.07.20 um 03:29 schrieb Matias Fonzo:
>
> UPDATE: I replaced the current lines with a printf ala:
>
> printf '%s\n' \
> "
> Usage: $PROGRAM COMMAND [OPTIONS] [FILE]...
> A simple but well-integrated package manager.
>
> Defaults for the options are specified in brackets.
>
> List of commands:
> ...
> "
>
> So much for the need of an external command and the use of heredoc... :-)
Well, you've just introduced a subtle way to shoot yourself in the foot
because now, every double quote that ever enters that help text better
be escaped with a backslash.
Using a heredoc – and that would mean using cat(1) – would avoid this
problem entirely.
So, let me repeat:
1. Speed is not of importance for printing help text. Therefore, using
an external command – cat(1), which is part of POSIX – is fine.
After all, making use of external commands is largely what Unix
shells are built for.
2. Heredocs are safe because they are interpreted as literal strings
entirely (using a single-quoted delimiter).
3. printf is not safe for this.
So, I would really go with cat(1) and a heredoc. It's less code and it
is actually more reliable than the current solution.
--Michael
- [Dragora-members] Qi 2.0rc14, Matias Fonzo, 2020/07/24
- Re: [Dragora-members] Qi 2.0rc14, Michael Siegel, 2020/07/24
- Re: [Dragora-members] Qi 2.0rc14, Matias Fonzo, 2020/07/24
- Re: [Dragora-members] Qi 2.0rc14, Michael Siegel, 2020/07/24
- Re: [Dragora-members] Qi 2.0rc14, Matias Fonzo, 2020/07/25
- Re: [Dragora-members] Qi 2.0rc14, Michael Siegel, 2020/07/30
- Re: [Dragora-members] Qi 2.0rc14, Matias Fonzo, 2020/07/30
- Re: [Dragora-members] Qi 2.0rc14, Matias Fonzo, 2020/07/30
- Re: [Dragora-members] Qi 2.0rc14,
Michael Siegel <=
- Re: [Dragora-members] Qi 2.0rc14, Michael Siegel, 2020/07/31