Re: Yet another attempt to specify GECOS hga@xxxxxx 27 Aug 2019 16:05 UTC

From: Lassi Kortela <xxxxxx@lassi.io>
Date: Tuesday, August 27, 2019 10:25 AM

>>>         "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.

Spot on.

> 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?

That most certainly works for me, modulo my not seeing the sense of
trying this in the first place.

> 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).

I was thinking they'd be returned as empty strings in the list, and
you're right about Debian, or in this case downstream Ubuntu, which
turned the full name I supplied into "Harold Ancell,,," Excluding any
would be sub-optimal unless all are empty.

> 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

We might want to weaken "is the user's real name" to "is by convention
the user's real name", human system admins can put *anything* in there.

> 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."

That sound very good to me.

- Harold