"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: got backout/cherrypick metadata (for commit log messages)
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Fri, 27 Jan 2023 13:51:58 +0100

Download raw body.

Thread
On 2023/01/27 22:50:26 +1100, Mark Jamsek <mark@jamsek.com> wrote:
> +	# make sure the remaining ref in work tree 2 was not also deleted
> +	echo $sep > $testroot/stdout.expected
> +	echo "commit $branch2_rev2 (newbranch2)" >> $testroot/stdout.expected
> +	echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
> +	echo "date: $date2" >> $testroot/stdout.expected
> +	printf " \n $b2_logmsg2\n \n" >> $testroot/stdout.expected
> +	printf "$b2_changeset2\n\n" >> $testroot/stdout.expected

much likely this will never be an issue here, but since I was bitten
by it recently I'm adding a note.

printf(1) shouldn't have flags but it _may_ still try to interpret its
argument as flags.  On OpenBSD the printf(1) implementaiton is sane
(IMHO) and only skips the first argument if it is "--" as a special
case, otherwise it interprets it as the format string.  Other
printf(1) may error instead

	$ uname -o
	FreeBSD
	$ printf "-hello, world!\n"
	printf: illegal option -- h
	usage: printf format [arguments ...]

(IIRC GNU printf should have the *indispensable* --version and
--help.)

so I'd try to avoid printf "$variable" and instead do printf "%s"
"$variable", like you'd do in C (but for other reasons.)

there may be other instances of printf format strings with variables
in the format string in the regress suite already, so don't waste time
fixing the printfs, we can do a sweep on the next rainy day :)