diff --git a/debian/changelog b/debian/changelog index 6c89b5a185d111029232e84ffc754f7869e88934..1045379be962828776465bf71f99145f9017db77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,11 @@ postgresql-common (124) UNRELEASED; urgency=low the latter was reported to not work on some systems. * pg_ctlcluster: Use PgCommon::check_pidfile_running and drop duplicated code. + * pg_wrapper: The previous multiarch globbing was wrong, as it looked for + the architecture in uname() (which doesn't work on i386, where uname says + i686). Now get the multiarch library path from whereever psql expects + libedit.so to be, so that this even works if you install postgresql-client + for a foreign architecture. -- Martin Pitt <mpitt@debian.org> Fri, 07 Oct 2011 19:04:19 +0200 diff --git a/pg_wrapper b/pg_wrapper index 2c41d14f54f27c103422cb14d26bb5e9520159e2..9ba0272d7d70a1cda904278de187611eca1d60b3 100755 --- a/pg_wrapper +++ b/pg_wrapper @@ -102,9 +102,21 @@ my $cmd = get_program_path ($cmdname, $version); # libreadline is a lot better than libedit, so prefer that if ($cmdname eq 'psql') { my @readlines; - my $arch = (POSIX::uname)[4]; - push @readlines, sort(</lib/$arch-*/libreadline.so.*>); - push @readlines, sort(</lib/libreadline.so.*>); + # non-multiarch path + @readlines = sort(</lib/libreadline.so.?>); + + unless (@readlines) { + # get multiarch dir for our architecture + if (open PS, '-|', '/usr/bin/ldd', $cmd) { + my $out; + read PS, $out, 10000; + close PS; + my ($lib_path) = $out =~ m!(/lib/.*)/libedit.so!; + + @readlines = sort(<$lib_path/libreadline.so.?>); + } + } + if (@readlines) { $ENV{'LD_PRELOAD'} = ($ENV{'LD_PRELOAD'} or '') . ':' . $readlines[-1]; }