Package: postgresql-client-common
Version: 113
Severity: normal

Hello,

According to the postgresql documentation [1], the equal sign between
the key and the value is optional in postgresql.conf.

In my postgresql.conf, If I set "port 5432" (instead of "port = 5432")
and restart postgresql (/etc/init.d/postgresql restart) I get the
following error:
  Restarting PostgreSQL 8.4 database server: mainError: Invalid line
63 in /etc/postgresql/8.4/main/postgresql.conf: »port 5433 « ...
failed!
   failed!

The attached patch fixes the issue and also add an optional equal sign
in the include directive regex.

Regards,

fredj

[1] http://www.postgresql.org/docs/8.4/interactive/config-setting.html

-- 
Frédéric Junod
Camptocamp SA
--- /usr/share/postgresql-common/PgCommon.pm.orig	2011-03-16 17:29:42.000000000 +0100
+++ /usr/share/postgresql-common/PgCommon.pm	2011-03-16 17:30:33.000000000 +0100
@@ -98,7 +98,7 @@
         while (<F>) {
             if (/^\s*(?:#.*)?$/) {
                 next;
-	    } elsif (/^\s*include\s+'([^']+)'\s*$/) {
+	    } elsif (/^\s*include\s*=?\s*'([^']+)'\s*$/) {
 		my ($k, $v, $path, %include_conf);
 		$path = $1;
 		unless (substr($path, 0, 1) eq '/') {
@@ -113,13 +113,13 @@
 		    $conf{$k} = $v;
 		}
 
-            } elsif (/^\s*([a-zA-Z0-9_.-]+)\s*=\s*'((?:[^']|(?:(?<=\\)'))*)'\s*(?:#.*)?$/) {
+            } elsif (/^\s*([a-zA-Z0-9_.-]+)\s*=?\s*'((?:[^']|(?:(?<=\\)'))*)'\s*(?:#.*)?$/) {
                 # string value
                 my $k = $1;
                 my $v = $2;
                 $v =~ s/\\(.)/$1/g;
                 $conf{$k} = $v;
-            } elsif (/^\s*([a-zA-Z0-9_.-]+)\s*=\s*(-?[\w.]+)\s*(?:#.*)?$/) {
+            } elsif (/^\s*([a-zA-Z0-9_.-]+)\s*=?\s*(-?[\w.]+)\s*(?:#.*)?$/) {
                 # simple value
                 $conf{$1} = $2;
             } else {

Reply via email to