bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18240: sql-postgres does not prompt for password


From: Matthew Smiglarski
Subject: bug#18240: sql-postgres does not prompt for password
Date: Sun, 2 Nov 2014 17:49:49 +0000

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@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@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@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.
>
>

Attachment: emacs-trunk-with-patch.png
Description: PNG image

Attachment: emacs24.3.1-sql-postgres-password-prompt.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]