Package: postgresql-client-8.1
Version: 8.1.1-1
Severity: normal
Tags: patch

I'd previously opened bug #343128 against libreadline5 about this, but
the discussion there convinced me that the bug is actually in psql.

psql expands %[ and %] to \001\001 and \001\002 respectively.
Apparently the leading \001 is a bash internal thing and isn't part of
the "official" prompt ignore sequence.

With readline 5.1, this additional character causes propblems.  When %[
and %] are used, the cursor ends up over some character in the prompt.
When just \001 and \002 are used, the cursor ends up in the correct
place with versions 5.0 and 5.1 of readline.

The attached patch (ready to drop into the debian/patches directory)
fixes this problem.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-2-k7
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages postgresql-client-8.1 depends on:
ii  libc6                         2.3.5-8.1  GNU C Library: Shared libraries an
ii  libkrb53                      1.4.3-3    MIT Kerberos runtime libraries
ii  libpam0g                      0.79-3     Pluggable Authentication Modules l
ii  libpq4                        8.1.1-1    PostgreSQL C client library
ii  libreadline5                  5.1-1      GNU readline and history libraries
ii  libssl0.9.8                   0.9.8a-5   SSL shared libraries
ii  postgresql-common             37         manager for PostgreSQL database cl
ii  zlib1g                        1:1.2.3-8  compression library - runtime

postgresql-client-8.1 recommends no packages.

-- no debconf information
Binary files postgresql-8.1.1.orig/src/bin/psql/.prompt.c.swp and 
postgresql-8.1.1/src/bin/psql/.prompt.c.swp differ
diff -ruN postgresql-8.1.1.orig/src/bin/psql/prompt.c 
postgresql-8.1.1/src/bin/psql/prompt.c
--- postgresql-8.1.1.orig/src/bin/psql/prompt.c 2005-12-16 09:12:48.000000000 
-0600
+++ postgresql-8.1.1/src/bin/psql/prompt.c      2005-12-16 09:14:04.000000000 
-0600
@@ -296,8 +296,7 @@
                                         * characters in prompt strings must be 
marked as such, in
                                         * order to properly display the line 
during editing.
                                         */
-                                       buf[0] = '\001';
-                                       buf[1] = (*p == '[') ? 
RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE;
+                                       buf[0] = (*p == '[') ? 
RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE;
 #endif   /* USE_READLINE */
                                        break;
 

Reply via email to