GNU bug report logs - #18240
24.3; sql-postgres password with cygwin psql

Previous Next

Package: emacs;

Reported by: Mark Wilkinson <wilkinsonmr <at> gmail.com>

Date: Sun, 10 Aug 2014 16:51:02 UTC

Severity: normal

Tags: moreinfo, unreproducible

Found in version 24.3

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18240 in the body.
You can then email your comments to 18240 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18240; Package emacs. (Sun, 10 Aug 2014 16:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mark Wilkinson <wilkinsonmr <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 10 Aug 2014 16:51:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mark Wilkinson <wilkinsonmr <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; sql-postgres password with cygwin psql
Date: Sun, 10 Aug 2014 10:50:16 -0500
[Message part 1 (text/plain, inline)]
Starting emacs 24.3.1 with -Q, sql.el version: 3.4

1. Set sql-postgres-program to psql from cygwin:

     (setq sql-postgres-program "c:/cygwin/bin/psql.exe")

2. Run sql-postgres
3. At prompts, enter user (postgres), database (postgres), server
   (localhost).

4. Wait for sql-delay seconds. Login...done.
   Buffer is *SQL* (SQLi[Postgres]:run).
   Prompt for password still not seen.  This is the problem.
   psql prompt not seen.

5. <RET> in that buffer yields

     Password for user postgres:
     psql: fe_sendauth: no password supplied

   and buffer's process dies.

However, repeating steps 2 through 4, doing send-invisible and
entering the password, the process remains and accepts input and
produces psql output (still no psql prompt, though). This does not
work with Windows psql.exe.

This also occurs in emacs-24-20140526-154828-w32-bin where sql.el 3.4
is the default version.



In GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $EMACSDATA: C:/emacs-24.3/etc
  value of $EMACSDOC: C:/emacs-24.3/etc
  value of $EMACSLOADPATH:
C:/emacs-24.3/site-lisp;C:/emacs-24.3/../site-lisp;C:/emacs-24.3/lisp;C:/emacs-24.3/leim
  value of $EMACSPATH: C:/emacs-24.3/bin
  value of $LANG: ENU
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<escape> x r e p o r t SPC e m a c s SPC b SPC <re
turn>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
c:/emacs-24.3/site-lisp/sql hides c:/emacs-24.3/lisp/progmodes/sql

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win
w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32 multi-tty emacs)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18240; Package emacs. (Mon, 22 Sep 2014 08:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 18240 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Smiglarski <matthew.smiglarski <at> gmail.com>
To: 18240 <at> debbugs.gnu.org, mmaug <at> yahoo.com
Subject: sql-postgres does not prompt for password
Date: Mon, 22 Sep 2014 09:10:11 +0100
This bug does not happen on the 24.3 release but does happen on 24.3.93.

The problem is with sql-interactive-remove-continuation-prompt, one of
the functions configured to be called by comint-output-filter.

It is caused by code introduced by this git revision.

commit 34499a8eb3c10db8c79a7aa87e1bbce0ae499fb6
Author: Michael Mauger <mmaug <at> yahoo.com>
Date:   Tue Jul 23 20:25:53 2013 -0400

One workaround is to type the password in anyway. Another workaround
is to remove some of the code with the following patch:

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 13d4178..2fd755d 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3337,18 +3337,7 @@ to avoid deleting non-prompt output."
         (unless prompt-found
           (setq sql-output-newline-count nil
                 oline (concat oline sql-preoutput-hold)
-                sql-preoutput-hold ""))
-
-        ;; Break up output by physical lines if we haven't hit the final prompt
-        (unless (and (not (string= oline ""))
-                     (string-match (sql-ends-with-prompt-re) oline)
-                     (>= (match-end 0) (length oline)))
-          (setq last-nl 0)
-          (while (string-match "\n" oline last-nl)
-            (setq last-nl (match-end 0)))
-          (setq sql-preoutput-hold (concat (substring oline last-nl)
-                                           sql-preoutput-hold)
-                oline (substring oline 0 last-nl))))))
+                sql-preoutput-hold "")))))
    oline)

This sql-interactive-remove-continuation-prompt function removes
continuation prompt (the prompt sent when halfway through a command)
and this improves the usability of multi-line SQL statements on the
interpreter.

There is another small bug with that code where the continuation line
sneaks through, throwing the alignment out.

By this, I mean the "template1->" prompt in the following examples:

template1=> select 42;
 ?column?
----------
       42
(1 row)

template1=> select
42;
template1->  ?column?
----------
       42
(1 row)

template1=> select
42,
43;
template1->  ?column? | ?column?
----------+----------
       42 |       43
(1 row)

That happens because of the following lines:

        ;; Add this text to what's left from the last pass
        (setq oline (concat sql-preoutput-hold oline)
              sql-preoutput-hold "")

I hope this helps.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18240; Package emacs. (Sat, 18 Oct 2014 12:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 18240 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: 18240 <at> debbugs.gnu.org
Subject: 24.3; sql-postgres password with cygwin psql
Date: Sat, 18 Oct 2014 16:41:59 +0400
It's not clear what this code is supposed to do...  However it breaks
entering passwords.  Maybe just remove it?

        ;; Break up output by physical lines if we haven't hit the final prompt
        (unless (and (not (string= oline ""))
                     (string-match (sql-ends-with-prompt-re) oline)
                     (>= (match-end 0) (length oline)))
          (setq last-nl 0)
          (while (string-match "\n" oline last-nl)
            (setq last-nl (match-end 0)))
          (setq sql-preoutput-hold (concat (substring oline last-nl)
                                           sql-preoutput-hold)
                oline (substring oline 0 last-nl))))))

-- 
    Filipp




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18240; Package emacs. (Fri, 31 Oct 2014 20:38:02 GMT) Full text and rfc822 format available.

Message #14 received at 18240 <at> debbugs.gnu.org (full text, mbox):

From: Michael Mauger <michael <at> mauger.com>
To: Matthew Smiglarski <matthew.smiglarski <at> gmail.com>, 
 "18240 <at> debbugs.gnu.org" <18240 <at> debbugs.gnu.org>
Subject: Re: sql-postgres does not prompt for password
Date: Fri, 31 Oct 2014 20:37:30 +0000 (UTC)
[Message part 1 (text/plain, inline)]
I apologize for the delay,I've been off-line for a bit.  I was aware of the failure in some edge cases and I think I have a solution.  I've attached an elisp file that you should be able to require once sql.el has been loaded that overrides the function as it appears in sql.el.
Please give it a try and see if it corrects the behavior you see.
Thanks
Michael
 

     On Monday, September 22, 2014 4:10 AM, Matthew Smiglarski <matthew.smiglarski <at> gmail.com> wrote:
   
 

 This bug does not happen on the 24.3 release but does happen on 24.3.93.

The problem is with sql-interactive-remove-continuation-prompt, one of
the functions configured to be called by comint-output-filter.

It is caused by code introduced by this git revision.

commit 34499a8eb3c10db8c79a7aa87e1bbce0ae499fb6
Author: Michael Mauger <mmaug <at> yahoo.com>
Date:  Tue Jul 23 20:25:53 2013 -0400

One workaround is to type the password in anyway. Another workaround
is to remove some of the code with the following patch:

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 13d4178..2fd755d 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3337,18 +3337,7 @@ to avoid deleting non-prompt output."
        (unless prompt-found
          (setq sql-output-newline-count nil
                oline (concat oline sql-preoutput-hold)
-                sql-preoutput-hold ""))
-
-        ;; Break up output by physical lines if we haven't hit the final prompt
-        (unless (and (not (string= oline ""))
-                    (string-match (sql-ends-with-prompt-re) oline)
-                    (>= (match-end 0) (length oline)))
-          (setq last-nl 0)
-          (while (string-match "\n" oline last-nl)
-            (setq last-nl (match-end 0)))
-          (setq sql-preoutput-hold (concat (substring oline last-nl)
-                                          sql-preoutput-hold)
-                oline (substring oline 0 last-nl))))))
+                sql-preoutput-hold "")))))
    oline)

This sql-interactive-remove-continuation-prompt function removes
continuation prompt (the prompt sent when halfway through a command)
and this improves the usability of multi-line SQL statements on the
interpreter.

There is another small bug with that code where the continuation line
sneaks through, throwing the alignment out.

By this, I mean the "template1->" prompt in the following examples:

template1=> select 42;
 ?column?
----------
      42
(1 row)

template1=> select
42;
template1->  ?column?
----------
      42
(1 row)

template1=> select
42,
43;
template1->  ?column? | ?column?
----------+----------
      42 |      43
(1 row)

That happens because of the following lines:

        ;; Add this text to what's left from the last pass
        (setq oline (concat sql-preoutput-hold oline)
              sql-preoutput-hold "")

I hope this helps.


 
   
[Message part 2 (text/html, inline)]
[sql-interactive-remove-continuation-prompt.el (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18240; Package emacs. (Sun, 02 Nov 2014 17:50:02 GMT) Full text and rfc822 format available.

Message #17 received at 18240 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Smiglarski <matthew.smiglarski <at> gmail.com>
To: Michael Mauger <michael <at> mauger.com>
Cc: "18240 <at> debbugs.gnu.org" <18240 <at> debbugs.gnu.org>
Subject: Re: sql-postgres does not prompt for password
Date: Sun, 2 Nov 2014 17:49:49 +0000
[Message part 1 (text/plain, inline)]
Hello, and thanks for the reply.

I tried the patch on trunk and found that the continuation lines are
shown and there is no interference with the alignment of the tabular
output, however the password prompt still isn't presented until the
after the password is entered.

I have attached 2 screenshots:

* emacs24.3.1-sql-postgres-password-prompt.png
Shows the password prompt in the previous version.

* emacs-trunk-with-patch.png
Shows the behaviour I found both before and after your patch.
While the continuation line output is different, you can see that the
password prompt comes after the user input both before and after
eval-ing your patch. (To be clear, I eval your patch about halfway
down, as indicated in the comment beginning "-- Evaluated ...".)

Admittedly this isn't a huge problem to me because I know the
workaround where typing in the password unprompted will log me in
anyway, instead displaying the prompt after I hit return!

Thanks,
Matthew

On Fri, Oct 31, 2014 at 8:37 PM, Michael Mauger <michael <at> mauger.com> wrote:
> I apologize for the delay,I've been off-line for a bit.  I was aware of the
> failure in some edge cases and I think I have a solution.  I've attached an
> elisp file that you should be able to require once sql.el has been loaded
> that overrides the function as it appears in sql.el.
>
> Please give it a try and see if it corrects the behavior you see.
>
> Thanks
>
> Michael
>
>
> On Monday, September 22, 2014 4:10 AM, Matthew Smiglarski
> <matthew.smiglarski <at> gmail.com> wrote:
>
>
>
> This bug does not happen on the 24.3 release but does happen on 24.3.93.
>
> The problem is with sql-interactive-remove-continuation-prompt, one of
> the functions configured to be called by comint-output-filter.
>
> It is caused by code introduced by this git revision.
>
> commit 34499a8eb3c10db8c79a7aa87e1bbce0ae499fb6
> Author: Michael Mauger <mmaug <at> yahoo.com>
> Date:  Tue Jul 23 20:25:53 2013 -0400
>
> One workaround is to type the password in anyway. Another workaround
> is to remove some of the code with the following patch:
>
> diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
> index 13d4178..2fd755d 100644
> --- a/lisp/progmodes/sql.el
> +++ b/lisp/progmodes/sql.el
> @@ -3337,18 +3337,7 @@ to avoid deleting non-prompt output."
>         (unless prompt-found
>           (setq sql-output-newline-count nil
>                 oline (concat oline sql-preoutput-hold)
> -                sql-preoutput-hold ""))
> -
> -        ;; Break up output by physical lines if we haven't hit the final
> prompt
> -        (unless (and (not (string= oline ""))
> -                    (string-match (sql-ends-with-prompt-re) oline)
> -                    (>= (match-end 0) (length oline)))
> -          (setq last-nl 0)
> -          (while (string-match "\n" oline last-nl)
> -            (setq last-nl (match-end 0)))
> -          (setq sql-preoutput-hold (concat (substring oline last-nl)
> -                                          sql-preoutput-hold)
> -                oline (substring oline 0 last-nl))))))
> +                sql-preoutput-hold "")))))
>     oline)
>
> This sql-interactive-remove-continuation-prompt function removes
> continuation prompt (the prompt sent when halfway through a command)
> and this improves the usability of multi-line SQL statements on the
> interpreter.
>
> There is another small bug with that code where the continuation line
> sneaks through, throwing the alignment out.
>
> By this, I mean the "template1->" prompt in the following examples:
>
> template1=> select 42;
> ?column?
> ----------
>       42
> (1 row)
>
> template1=> select
> 42;
> template1->  ?column?
> ----------
>       42
> (1 row)
>
> template1=> select
> 42,
> 43;
> template1->  ?column? | ?column?
> ----------+----------
>       42 |      43
> (1 row)
>
> That happens because of the following lines:
>
>         ;; Add this text to what's left from the last pass
>         (setq oline (concat sql-preoutput-hold oline)
>               sql-preoutput-hold "")
>
> I hope this helps.
>
>
[emacs-trunk-with-patch.png (image/png, attachment)]
[emacs24.3.1-sql-postgres-password-prompt.png (image/png, attachment)]

Added tag(s) unreproducible and moreinfo. Request was from Michael Mauger <mmauger <at> protonmail.com> to control <at> debbugs.gnu.org. (Sun, 21 Apr 2019 06:03:03 GMT) Full text and rfc822 format available.

Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Wed, 12 Aug 2020 18:40:03 GMT) Full text and rfc822 format available.

Notification sent to Mark Wilkinson <wilkinsonmr <at> gmail.com>:
bug acknowledged by developer. (Wed, 12 Aug 2020 18:40:03 GMT) Full text and rfc822 format available.

Message #24 received at 18240-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Michael Mauger <mmauger <at> protonmail.com>
Cc: 18240-done <at> debbugs.gnu.org
Subject: Re: Close bugs
Date: Wed, 12 Aug 2020 11:39:19 -0700
It seems like the intention below was to close this bug.  I'm going to
boldly assume that is correct and close this bug now.

If this conclusion is incorrect, please reply to this email (use "Reply
to all" in your email client) and we can reopen the bug report.

Best regards,
Stefan Kangas

Michael Mauger <mmauger <at> protonmail.com> writes:

> # placeholder
> close 11481 27.0.50
> # missing prompt-cont-regexp handling
> close 24483 27.0.50
> # postgres password prompt
> tag 18066 + unreproducible moreinfo
> tag 18240 + unreproducible moreinfo
> tag 20288 + unreproducible moreinfo
> tag 20289 + unreproducible moreinfo notabug
> tag 23063 + unreproducible moreinfo
> tag 29105 + unreproducible moreinfo
>
> tag 3569 + notabug
> close 3569
>
> close 14759 26.1
>
> tag 15202 + notabug
>
> tag 22016 + unreproducible moreinfo
> close 22106 26.1
>
> close 30247 27.0.50
>
> thank you
>
> --
> MICHAEL <at> MAUGER.COM // FSF and EFF member // GNU Emacs sql.el maintainer




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.