Thread: [HACKERS] Debian "postgresql-common" config check issue with pg10

[HACKERS] Debian "postgresql-common" config check issue with pg10

From
Fabien COELHO
Date:
Hello Peter,

Although this is really a small debian packaging issue, I cc to pgdev 
because it illustrates unintended consequences of trivial changes.

Thanks (again!) to the great and up-to-date apt.postgresql.org repository, 
I've tried to test the new scram-sha-256 feature. For that I looked in 
"postgres.conf" and found:
  #password_encryption = md5      # md5, scram-sha-256 or plain

Thus I naïvely added:
  password_encryption = scram-sha-256

After:
  sh> pg_ctlcluster 10 main start

The result is:
  Error: Invalid line 88 in /etc/postgresql/10/main/postgresql.conf:    »password_encryption = scram-sha-256«

However, it works if I put 'scram-sha-256' (with simple quotes).

The underlying issue is that the '-' character breaks the config checker, 
ISTM that the simple value regex in function "read_conf_file" in module 
"PgCommon.pm" should be extended to allow more chars in unquoted strings, 
to be consistent with lexer definitions in 
"src/backend/utils/misc/guc-file.l".

I think that the issue appeared when 'scram' was changed to 
'scram-sha-256' recently, as it is the first option enum with a dash, 
all other options use '_'.

In passing, I would like to point out that the French quotation chevrons 
(guillemets) used on the wrong sides and without spacing is probably eye 
watering pain to any French reader, maybe like using ß in place of B in a 
text. Also utf8 chars might not work properly under some terminal 
encodings. Maybe using simple ascii ">>" and "<<" for the messages would 
also be more portable?

-- 
Fabien.

Re: Fabien COELHO 2017-05-08 <alpine.DEB.2.20.1705081730030.3983@lancre>
> Thus I naïvely added:
> 
>   password_encryption = scram-sha-256

Hmm. Naïvely I would have assumed this would be missing quotes :)

> The result is:
> 
>   Error: Invalid line 88 in /etc/postgresql/10/main/postgresql.conf:
>     »password_encryption = scram-sha-256«
> 
> However, it works if I put 'scram-sha-256' (with simple quotes).
> 
> The underlying issue is that the '-' character breaks the config checker,
> ISTM that the simple value regex in function "read_conf_file" in module
> "PgCommon.pm" should be extended to allow more chars in unquoted strings, to
> be consistent with lexer definitions in "src/backend/utils/misc/guc-file.l".

I've relaxed the regexps there. It's still not exactly what the PG
parser accepts, but I think it's a superset now, so we should be safe.


https://anonscm.debian.org/cgit/pkg-postgresql/postgresql-common.git/commit/?id=93a2ec91ea83e427fc2e68789e572864e158a32e

> In passing, I would like to point out that the French quotation chevrons
> (guillemets) used on the wrong sides and without spacing is probably eye
> watering pain to any French reader, maybe like using ß in place of B in a
> text. Also utf8 chars might not work properly under some terminal encodings.
> Maybe using simple ascii ">>" and "<<" for the messages would also be more
> portable?

I think »« are used the other way round in German vs. French, that's
probably why it was like that ;). Anyway, we are not quoting output in
most of the error() calls, so I've simply dropped the quotes.

Thanks for spotting and reporting!

Christoph



Hallo Christoph,

>>   password_encryption = scram-sha-256
>
> Hmm. Naïvely I would have assumed this would be missing quotes :)

That what I thought at first, but the comments, documentation and code 
were saying otherwise, so I dug into debian packaging instead.

> I've relaxed the regexps there. It's still not exactly what the PG
> parser accepts, but I think it's a superset now, so we should be safe.

Ok.

> Thanks for spotting and reporting!

Thanks for the fix! Will it be released with the next pg10dev compilation?

-- 
Fabien.

Hallo Christoph,

>> I've relaxed the regexps there. It's still not exactly what the PG
>> parser accepts, but I think it's a superset now, so we should be safe.

> Will it be released with the next pg10dev compilation?

The answer is "yes", and it works as expected.

Vielen Dank again for the fix!

-- 
Fabien.