emacs-devel
[Top][All Lists]
Advanced

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

Re: [bug] read-passwd of CVS Emacs


From: Kevin Rodgers
Subject: Re: [bug] read-passwd of CVS Emacs
Date: Wed, 24 May 2006 12:29:07 -0600
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

David Kastrup wrote:
Kevin Rodgers <address@hidden> writes:

Kazu Yamamoto (山本和彦) wrote:
If the CONFIRM argument is specified to read-passwd of CVS Emacs, it
causes an error after a user type a first password.

        (read-passwd "password: " t)
The error is "Attempt to modify read-only object" and is somehow caused
by a string indexing bug.  Here's a patch:
...
Looks like causing trouble when the prompt is an empty string.  And it
looks like it would leave the properties off the last character of the
prompt.  Correct?

You're right on both counts -- thanks for catching that!  I should have
investigated further before posting a patch that has nothing to do with
the underlying error.

The strange thing is that the error is definitely triggered by the call
to add-text-properties, but only in the second recursive call (not the
first):

Debugger entered--Lisp error: (error "Attempt to modify read-only object")
add-text-properties(0 18 (read-only t face minibuffer-prompt) "Confirm password: ") byte-code(... [inhibit-quit confirm success prompt default second nil read-passwd "Confirm password: " arrayp clear-string message "Password not repeated accurately; please start over" sit-for 1 0 t add-text-properties "%s%s" make-string 46 read-char-exclusive 13 10 27 clear-this-command-keys 21 "" 8 127 char-to-string -1 "" first message-log-max cursor-in-echo-area echo-keystrokes c pass minibuffer-prompt-properties new-char new-pass] 7)
  read-passwd("Confirm password: " nil nil)
byte-code(... [inhibit-quit confirm success prompt default second nil read-passwd "Confirm password: " arrayp clear-string message "Password not repeated accurately; please start over" sit-for 1 0 t add-text-properties "%s%s" make-string 46 read-char-exclusive 13 10 27 clear-this-command-keys 21 "" 8 127 char-to-string -1 "" first message-log-max cursor-in-echo-area echo-keystrokes c pass minibuffer-prompt-properties new-char new-pass] 7)
  read-passwd(#("password: " 0 10 (face minibuffer-prompt read-only t)) t)
eval((read-passwd #("password: " 0 10 (face minibuffer-prompt read-only t)) t))
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  call-interactively(eval-print-last-sexp)

I checked the way minibuffer-prompt-properties are added in
src/minibuf.c and found that read_minibuf puts front-sticky,
rear-nonsticky, and field properties on the prompt first.  And emulating
that in read-passwd seems to do the trick:

2006-05-24  Kevin Rodgers  <address@hidden>
        * subr.el (read-passwd): Put front-sticky, rear-nonsticky, and field
        properties on PROMPT before adding minibuffer-prompt-properties, just
        like read_minibuf does.


*** lisp/subr.el~       2006-04-22 06:42:24.750000000 -0600
--- lisp/subr.el        2006-05-24 12:13:17.751556000 -0600
***************
*** 1541,1548 ****
            (c 0)
            (echo-keystrokes 0)
            (cursor-in-echo-area t)
!           (message-log-max nil))
!       (add-text-properties 0 (length prompt)
                             minibuffer-prompt-properties prompt)
        (while (progn (message "%s%s"
                               prompt
--- 1541,1552 ----
            (c 0)
            (echo-keystrokes 0)
            (cursor-in-echo-area t)
!           (message-log-max nil)
!           (prompt-length (length prompt)))
!       (put-text-property 0 prompt-length 'front-sticky t prompt)
!       (put-text-property 0 prompt-length 'rear-nonsticky t prompt)
!       (put-text-property 0 prompt-length 'field t prompt)
!       (add-text-properties 0 prompt-length
                             minibuffer-prompt-properties prompt)
        (while (progn (message "%s%s"
                               prompt

Thanks,
--
Kevin





reply via email to

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