Re: Yet another attempt to specify GECOS Lassi Kortela 27 Aug 2019 15:25 UTC

>>         "any and all ampersands in the first element of the list are
>>         replaced by the result of user-info:name with the first letter
>>         capitalized and other letters intact. If user-info:name does
>>         not start with a letter, its case is unaltered."
>>
>>     Works for me.

>     That helps to clarify the algorithm.  Here's my not yet committed
>     SRFI text that incorporates the above as simply as I can:
>
>>     The raw value [of user-info:full-name] is split on commas, creating
>>     a list of strings to be returned. All ampersands in the first
>>     element of the list are replaced by user-info:full-name, which is
>>     titlecased if it starts with a letter.

> That works except that "titlecased" means "first letter uppercased,
> other letters lowercased", which is not the case (heh) here.

Correct. I deliberately wrote the passage in an "explain as if readers
are five-year-olds" way because of subtleties like this :) As the years
go by I do more and more of my technical writing like that, including
emails. Misunderstanding is more expensive than verbosity.

In fact, the canonical implementations only uppercase the first char if
it's an ASCII byte. We should probably follow suit. Who has non-ascii
characters in their username?

Might also be worth clarifying what to do in case there are empty
subfields (as there often are on Debian - I think the GNU adduser
command adds them by default in a futile campaign to ensure that GECOS
always has a fixed number of fields).

Summing up the above in yet another attempt:

"The raw value [of user-info:full-name] is split into subfields at
commas, creating a list of strings to be returned. Whitespace is not
removed from any subfields, and blank subfields are preserved.

The first subfield is the user's real name. If it contains one or more
ampersand characters, each ampersand is replaced by user-info:name. If
the first character of user-info:name is an ASCII lowercase letter, it
is uppercased in the replacement. Otherwise it is kept intact. The
remaining characters are always kept intact."

BTW this "Up-Goer Five text editor" is a must-try if you haven't
already: <https://www.splasho.com/upgoer5/> "Up-Goer Five" refers to
Saturn V rocket, via xkcd: <https://xkcd.com/1133/>