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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: got backout/cherrypick metadata (for commit log messages)
To:
Omar Polo <op@omarpolo.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Sat, 28 Jan 2023 15:38:00 +1100

Download raw body.

Thread
On 23-01-27 01:51PM, Omar Polo wrote:
> 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 :)

Thanks, op! I've added the sweep to my todo list and made mention of
this in the commit message as another reminder :)

I did a quick search in cherrypick.sh and there are other instances so,
like you said, this may very well occur elsewhere in regress too.

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68