From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: [bug] read-passwd of CVS Emacs Date: Wed, 24 May 2006 12:29:07 -0600 Organization: IHS Message-ID: References: <20060524.123750.178780620.kazu@iij.ad.jp> <85u07f2xfq.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1148495467 11151 80.91.229.2 (24 May 2006 18:31:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 May 2006 18:31:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 24 20:31:06 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fiy8H-0000F6-OB for ged-emacs-devel@m.gmane.org; Wed, 24 May 2006 20:30:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fiy8H-0007HJ-6U for ged-emacs-devel@m.gmane.org; Wed, 24 May 2006 14:30:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fiy7c-0006qf-3P for emacs-devel@gnu.org; Wed, 24 May 2006 14:30:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fiy7W-0006pa-Rb for emacs-devel@gnu.org; Wed, 24 May 2006 14:30:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fiy7W-0006pX-MR for emacs-devel@gnu.org; Wed, 24 May 2006 14:30:10 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FiyC1-00062I-0v for emacs-devel@gnu.org; Wed, 24 May 2006 14:34:49 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Fiy7N-0008V9-8A for emacs-devel@gnu.org; Wed, 24 May 2006 20:30:01 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 May 2006 20:30:01 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 May 2006 20:30:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 89 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) In-Reply-To: <85u07f2xfq.fsf@lola.goethe.zz> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:55219 Archived-At: David Kastrup wrote: > Kevin Rodgers 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 * 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