From: Stefan Sperling Subject: Re: repository description in gotwebd.conf To: Johannes Thyssen Tishman , gameoftrees@openbsd.org Date: Mon, 12 Jan 2026 12:08:43 +0100 On Mon, Jan 12, 2026 at 10:21:49AM +0000, Johannes Thyssen Tishman wrote: > 2026-01-10T18:00:25+0100 Stefan Sperling : > > I would like to allow setting repository descriptions in gotwebd.conf. > > Use of this feature is optional and the behaviour remains unchanged if > > the feature is not used. > > > > Having this feature will make it easier to support setting repository > > descriptions for gotwebd via gotsysd. Write descriptions directly to > > gotwebd.conf avoids having to overwrite every repository's description > > file on disk. > > > > ok? > > -file in the repository should be updated with an appropriate description. > > +file in the repository should be updated with an appropriate description, > > We can leave the period here. Thanks, I'll fix this. > > @@ -942,6 +942,17 @@ repoopts1 : DISABLE AUTHENTICATION { > > | HIDE REPOSITORY boolean { > > new_repo->hidden = $3; > > } > > + | DESCRIPTION STRING { > > + n = strlcpy(new_repo->description, $2, > > + sizeof(new_repo->description)); > > + if (n >= sizeof(new_repo->description)) { > > + yyerror("repository description too long, " > > + "exceeds %zd bytes", > > + sizeof(new_repo->description) - 1); > > + free($2); > > + YYERROR; > > + } > > + } > > ; > > Couldn't we store sizeof(new_repo->description) in a variable here (or > use GOTWEBD_MAXDESCRSZ) to avoid calling sizeof() three times? I > understand that strlcpy writes to new_repo->description, but AFAIC we > only care about it's maximum size (GOTWEBD_MAXDESCRSZ), no? sizeof is an operator, not a function. It is evaluated at compile-time. See the EXAMPLES section of the strlcpy(3) manual for the origin of this idiom, which we use extensitively in our code base. i think this is fine as it is. It may be a bit verbose but it is consistent with other places in the our tree which use this idiom.