unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Davis Herring <sdh6@ra.msstate.edu>
Cc: Richard Stallman <rms@gnu.org>
Subject: Minor comint.el patch
Date: Thu, 25 Sep 2003 07:40:31 -0500 (CDT)	[thread overview]
Message-ID: <Pine.GSO.4.53.0309250656110.383@ra.msstate.edu> (raw)
In-Reply-To: <E1A1wLO-0007um-Hh@fencepost.gnu.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1189 bytes --]

Quoting Richard Stallman's mail of Tue, 23 Sep 2003 19:13:18 -0400:
> David's suggestion seems right to me.
> I will get it installed.  Thanks.

I'm assuming that you're referring either to my comment about
(and pw (send-invisible pw)), or else to Kevin Rodgers' suggestion of
(send-invisible (or pw "")) ...

Unfortunately, neither one of these is particularly useful; neither one of
them prints any sort of message (not even 'Quit') to indicate that the
password is no longer being read invisibly, and the latter actually sends
something (even if it's just a newline) when the user tries to abort the
command -- Bad Thing.

I believe what we want is a slight reorganization of those functions;
unless they get heavy Lisp usage, it shouldn't cause much
incompatibility damage.  The attached patch (versus 21.3.1) causes there
to be no further prompt but rather the proper warning when the user quits.
I also added references to 'clear-this-command-keys' in the docstrings;
would it make sense to make that function interactive?

Davis Herring

-- 
Ship Quantum Express -- the honest company that admits to having no idea
when your shipment will get there or where it will be when it does!

[-- Attachment #2: New vs. 21.3.1 --]
[-- Type: TEXT/PLAIN, Size: 3324 bytes --]

*** comint-21.3.el	Thu Sep 25 07:13:32 2003
--- comint.el	Thu Sep 25 07:33:26 2003
***************
*** 1874,1880 ****
  filter and C-g is pressed, this function returns nil rather than a string).
  
  Note that the keystrokes comprising the text can still be recovered
! \(temporarily) with \\[view-lossage].  Some people find this worrysome.
  Once the caller uses the password, it can erase the password
  by doing (fillarray STRING 0)."
    (let ((ans "")
--- 1874,1881 ----
  filter and C-g is pressed, this function returns nil rather than a string).
  
  Note that the keystrokes comprising the text can still be recovered
! \(temporarily) with \\[view-lossage].  Some people find this worrysome (see,
! however, `clear-this-command-keys').
  Once the caller uses the password, it can erase the password
  by doing (fillarray STRING 0)."
    (let ((ans "")
***************
*** 1921,1944 ****
        (message "")
        ans)))
  
! (defun send-invisible (str)
    "Read a string without echoing.
  Then send it to the process running in the current buffer.
  The string is sent using `comint-input-sender'.
  Security bug: your string can still be temporarily recovered with
! \\[view-lossage]."
    (interactive "P")			; Defeat snooping via C-x ESC ESC
    (let ((proc (get-buffer-process (current-buffer))))
!     (cond ((not proc)
! 	   (error "Current buffer has no process"))
! 	  ((stringp str)
! 	   (comint-snapshot-last-prompt)
! 	   (funcall comint-input-sender proc str))
! 	  (t
! 	   (let ((str (comint-read-noecho "Non-echoed text: " t)))
! 	     (if (stringp str)
! 		 (send-invisible str)
! 	       (message "Warning: text will be echoed")))))))
  
  (defun comint-watch-for-password-prompt (string)
    "Prompt in the minibuffer for password and send without echoing.
--- 1922,1943 ----
        (message "")
        ans)))
  
! (defun send-invisible (&optional prompt)
    "Read a string without echoing.
  Then send it to the process running in the current buffer.
  The string is sent using `comint-input-sender'.
  Security bug: your string can still be temporarily recovered with
! \\[view-lossage]; `clear-this-command-keys' can fix that."
    (interactive "P")			; Defeat snooping via C-x ESC ESC
    (let ((proc (get-buffer-process (current-buffer))))
!     (if proc
! 	(let ((str (comint-read-noecho (or prompt "Non-echoed text: ") t)))
! 	  (if (stringp str)
! 	      (progn
! 		(comint-snapshot-last-prompt)
! 		(funcall comint-input-sender proc str))
! 	    (message "Warning: text will be echoed")))
!       (error "Current buffer has no process"))))
  
  (defun comint-watch-for-password-prompt (string)
    "Prompt in the minibuffer for password and send without echoing.
***************
*** 1948,1955 ****
  
  This function could be in the list `comint-output-filter-functions'."
    (when (string-match comint-password-prompt-regexp string)
!     (let ((pw (comint-read-noecho string t)))
!       (send-invisible pw))))
  \f
  ;; Low-level process communication
  
--- 1947,1953 ----
  
  This function could be in the list `comint-output-filter-functions'."
    (when (string-match comint-password-prompt-regexp string)
!     (send-invisible string)))
  \f
  ;; Low-level process communication
  

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

      parent reply	other threads:[~2003-09-25 12:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-22  9:35 Minor comint.el bug Marshall, Simon
2003-09-22 14:05 ` Davis Herring
     [not found] ` <E1A1wLO-0007um-Hh@fencepost.gnu.org>
2003-09-25 12:40   ` Davis Herring [this message]

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=Pine.GSO.4.53.0309250656110.383@ra.msstate.edu \
    --to=sdh6@ra.msstate.edu \
    --cc=rms@gnu.org \
    /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).