[PATCH setup] Don't write garbage into the "extrakeys" user setting
Tue Nov 28 12:58:00 GMT 2017
On 11/27/2017 9:14 PM, Ken Brown wrote:
> On 11/27/2017 5:19 PM, Ken Brown wrote:
>> On 11/27/2017 4:35 PM, Ken Brown wrote:
>>> The ExtraKeysSetting destructor called UserSettings::set() on a string
>>> that was terminated by LF instead of NUL.Â This led to garbage at the
>>> end of the "extrakeys" setting that was written into setup.rc.Â Fix
>>> this by replacing the final LF by NUL before calling set().
>> Disregard this for now.Â I've just discovered some further issues
>> involving "extrakeys", and I'd like to fix them all at once.
> Here's an amusing fact: "extrakeys" has apparently been useless for many
> years, so that the '-u' option to setup cannot have worked.Â The reason
> is that '#' is a comment character in setup.rc, and the saved keys
> contain several of these.Â (Originally the saved keys were kept in a
> file /etc/setup/last-extrakeys, which did not contain comments, but this
> was changed in 2009 to use /etc/setup/setup.rc.)
> Here's an example from my own setup.rc after running 'setup -K ...':
> Â Â Â Â (public-key (dsa (p
> (q #00C2D926EC5053000FF6BAFFA16D39161F8DE16BDF#) (g
> ) )
> [The part below "extrakeys" is all one line.]
> Everything after the first '#' is discarded, and "extrakeys" is
> effectively set to "(public-key (dsa (p ".
> Out of sheer laziness, I'd like to fix this by no longer treating '#' as
> a comment character.Â The only use of it I've seen is in site.cc to
> write a comment about dropped mirrors being saved, although there might
> be other uses that I've missed.
> If this is not acceptable, then I guess we have to use something like
> '\#' to escape '#', or else choose a different comment character.
Another possibility, which I think would require only minimal changes,
is to treat '#' as a comment character only if it's the first
non-whitespace character on a line.
More information about the Cygwin-apps