[bug#72536] [PATCH] tap: new `--merge-prefix' option to prefix stderr before merging

Richard Hansen <[email protected]> Sat, 10 Aug 2024 02:55:00 -0400
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <[email protected]>
On 2024-08-09 22:47:32-04:00, Jacob Bachmeyer wrote:
> I would suggest `--label-stderr' or `--stderr-message-prefix' as better 
> option names to open a discussion.  The main problem I see with 
> `--merge-prefix' is that it is using "merge" in a sense that can only be 
> understood with the detailed context of what the TAP driver does.

Good point.  How about `--stderr-prefix`?  The downside to not including 
"merge" in the option name is that it isn't obviously tied to the 
`--merge` option.

I could make this option independent of `--merge` and always prefix each 
line of the test script's stderr.  That would make it easier for users 
to understand the option's behavior, even if it would rarely be used 
without `--merge`.

Or I could change it to something like `--merge-with-prefix` and have it 
automatically turn on `--merge`.


On a separate note, it's difficult to portably add a `#` character to a 
make variable, as you can see in the test I added.  Yet that is the one 
character that users will almost certainly want to include in the 
prefix.  I wonder if this should have a default prefix so that users 
don't have to figure out how to pass `#`.  Maybe something like:

   * `--stderr-prefix` by itself to prefix with the default of `# `
   * `--stderr-prefix custom-prefix` to prefix with `custom-prefix`

This would be a bit more complicated to implement because the script 
would need a heuristic to determine whether the user passed a custom 
prefix or not (such as, "there is an argument after `--stderr-prefix` 
and that argument does not begin with `-`").

-Richard


p.s. I requested a copyright assignment form.
OpenPGP_signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfoCctB7fyOzE09bW0GvrRa1X4hQFAma3DsUACgkQ0GvrRa1X
4hTMehAAksa172gWzjb4C8BRV3k8aW4eT1Nlpgx7M/UirimNp5T2+NTBB2QreQrJ
UaHHHN8JGRhSymAbAKo4NDaQDwwiQv5hPIjrK1/QJ521wMPUjbeMmtPJZ+ti3bfI
mIBs4gYTBR77/W3vlyEIMQYitkDy9IaR4iVsI2n0akSbLg5Re557+pDAxx1hJKx+
ZJTHvDoaERGm9olRmA/9xdQ3n1BBqDPF7LO4x6rGuKJNiq9rhVys9Lao+dtSlvHs
Lp8BLRuBIDvsl1Ba654qQBkQ6bwMzICoN2GcXm2NnzIs2JoKWSOTLbgOlegkMDdz
FX5mQJ5sQeSgZqWmDbJKbzodMsixP5yl4A4gpRgmZwQ+/4OCDRe8jp/PCTCtk87j
q1Bhq7QxTwa+7oZ71BSRTBic3uWwABrPtvq59GQJ1JJOTYvsB0NFvxEfMMM809kb
DRzj68+Bs4S5oUXQcGSTIe6aSwHK29xWOyICSpb8Hd8SpcN4kP9oO6+2t2IwR/be
lbzo79h6j5e7gQhoB3gyXi/OKJhukuNTqCsEW0rF2v/nr/+YvKjSvvvlz1TB1V3w
Mk0pjlOHi8BAke+BHkYR3S6Y+ACWzhehYjWU6PBewq9V6v6NhZH2tUGTQkdsA+4m
/83EUeI5vsm5e3gqB0Z6qNhuSK52SOyCECYAOuuS0xDbUJvrn9M=
=lUPq
-----END PGP SIGNATURE-----