Skip to content

Commit

Permalink
postgresql.aug: Allow hyphen '-' in values that don't require quotes (#…
Browse files Browse the repository at this point in the history
…700) (#701)

Since PostgreSQL 10 password_encryption is enum.
If the value is set to scram-sha-256 (which contains hyphens),
saving postgresql.conf with augeas fails with:

saving failed (run 'errors' for details)
Error in /var/lib/pgsql/13/data/postgresql.conf:782.0 (parse_skel_failed)
  Iterated lens matched less than it should
  Lens: /usr/share/augeas/lenses/dist/postgresql.aug:69.10-.46:
    Last matched: /usr/share/augeas/lenses/dist/postgresql.aug:30.10-.46:
    Next (no match): /usr/share/augeas/lenses/dist/quote.aug:117.2-.35:

This is because hyphen wasn't included in the definition of string
that doesn't require quoting.

Co-authored-by: Raphaël Pinson <[email protected]>
  • Loading branch information
marcinbarczynski and raphink authored Oct 22, 2020
1 parent 89bed1b commit ce9e687
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lenses/postgresql.aug
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let sep = del /([ \t]+)|([ \t]*=[ \t]*)/ " = "

(* Variable: word_opt_quot_re
Strings that don't require quotes *)
let word_opt_quot_re = /[A-Za-z][A-Za-z0-9_]*/
let word_opt_quot_re = /[A-Za-z][A-Za-z0-9_-]*/

(* View: word_opt_quot
Storing a <word_opt_quot_re>, with or without quotes *)
Expand Down
3 changes: 3 additions & 0 deletions lenses/tests/test_postgresql.aug
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ lc_messages = 'en_US.UTF-8'
log_filename = log
archive_command = 'tar \'quoted option\''
search_path = '\"$user\",public'
password_encryption = scram-sha-256
"
test Postgresql.lns get string_quotes =
{ "listen_addresses" = "localhost" }
Expand All @@ -115,6 +116,7 @@ test Postgresql.lns get string_quotes =
{ "log_filename" = "log" }
{ "archive_command" = "tar \'quoted option\'" }
{ "search_path" = "\"$user\",public" }
{ "password_encryption" = "scram-sha-256" }
test Postgresql.lns put string_quotes after
set "stats_temp_directory" "foo_bar";
set "log_filename" "postgresql-%Y-%m-%d_%H%M%S.log";
Expand All @@ -124,6 +126,7 @@ lc_messages = 'en_US.UTF-8'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
archive_command = 'tar \'quoted option\''
search_path = '\"$user\",public'
password_encryption = scram-sha-256
log_statement = 'none'
"

Expand Down

0 comments on commit ce9e687

Please sign in to comment.