Package: postgresql-common
Version: 101
Severity: important
Tags: patch

The set_conf_value() function, used to rewrite postgresql.conf and others,
does not properly checks for write errors, so the caller thinks all went
well and happily proceeds.  Only afterwards the user gets told about an
"Invalid data directory", which only reflects the fact that the original
config got lost.

The following patch only makes it so the problem does not go undetected. 
Maybe we could also avoid to open for writing the file we just read, and
use a temporary file for writing, as good practice would dictate.  If this
function is only ever called at create time it should not matter, but hey,
it is in a lib...

--- PgCommon.pm.orig    2009-07-23 23:27:52.000000000 +0200
+++ PgCommon.pm 2009-10-01 16:13:34.000000000 +0200
@@ -174,7 +174,7 @@
     # write configuration file lines
     open (F, '>'.$fname) or die "Error: could not open $fname for writing";
     foreach (@lines) {
-       print F $_;
+       print F $_ or die "$!";
     }
     close F;
 }

This could well be the same problem others reported against Ubuntu without
it being ever diagnosed:
https://bugs.launchpad.net/ubuntu/+source/postgresql-8.3/+bug/241553





--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to