unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: [bug] read-passwd of CVS Emacs
Date: Wed, 24 May 2006 12:29:07 -0600	[thread overview]
Message-ID: <e528n1$agf$1@sea.gmane.org> (raw)
In-Reply-To: <85u07f2xfq.fsf@lola.goethe.zz>

David Kastrup wrote:
> Kevin Rodgers <ihs_4664@yahoo.com> 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  <ihs_4664@yahoo.com>
	* 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	other threads:[~2006-05-24 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-24  3:37 [bug] read-passwd of CVS Emacs Kazu Yamamoto
2006-05-24 16:08 ` Kevin Rodgers
2006-05-24 16:35   ` David Kastrup
2006-05-24 18:29     ` Kevin Rodgers [this message]
2006-05-24 21:09       ` Johan Bockgård
2006-05-24 22:08       ` David Kastrup
2006-05-25  0:37   ` Richard Stallman
2006-05-25 16:31     ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='e528n1$agf$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).