Re: [PATCH 08/16] test-lib functions: add --printf option to test_commit

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

 



On Mon, Apr 12, 2021 at 7:09 AM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> wrote:
> Add a --printf option to test_commit to allow writing to the file with
> "printf" instead of "echo".
>
> This is useful for writing "\n", "\0" etc., in particular in
> combination with the --append option added in 3373518cc8 (test-lib
> functions: add an --append option to test_commit, 2021-01-12).
> [...]
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---

Just a bit of pure bikeshedding...

> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> @@ -173,6 +173,10 @@ debug () {
> +#   --printf
> +#       Use "printf" instead of "echo" when writing "<contents>" to
> +#       "<file>". You will need to provide your own trailing "\n". You
> +#       can only supply the FORMAT for the printf(1), not its ARGUMENT(s).

The name "printf" has such strong association in programmer's minds
with "%" and argument consumption that the name of this option alone
almost begs people to take advantage of argument interpolation even
though it's documented here as not allowing it. Taking into
consideration that people often do not read documentation, `--printf`
as the name of the option may be an unfortunate one. Perhaps it could
be called `--raw` or something less likely to suggest argument
interpolation.

> @@ -192,6 +196,7 @@ debug () {
>
>  test_commit () {
>         notick= &&
> +       echo=echo &&

This could be slightly confusing. I wonder if naming this variable
`emit` would be clearer.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux