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

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

bug#22027: 25.1.50; Return uncorrupted default string


From: Tino Calancha
Subject: bug#22027: 25.1.50; Return uncorrupted default string
Date: Mon, 9 May 2016 12:26:13 +0900 (JST)
User-agent: Alpine 2.20 (LRH 67 2015-01-07)


*) first argument non-nil,
*) second argument string != "",
Should read:
*) second argument non-nil,
*) third argument string != "",



In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30)
 of 2016-05-06 built on calancha-pc
Repository revision: 80bea210ff14a64daa1d71765983aa3baa149555


From 1ced98ba1a548749c119a93858f82f1210fe81bc Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 9 May 2016 12:01:31 +0900
Subject: [PATCH 1/3] Return uncorrupted default string

* lisp/subr.el (read-passwd): Return DEFAULT when
CONFIRM evaluates non-nil and user inputs the empty string
(Bug#22027).
---
 lisp/subr.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 0fa6404..ef6af1d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2152,9 +2152,9 @@ read-passwd
           (let ((first (read-passwd prompt nil default))
                 (second (read-passwd "Confirm password: " nil default)))
             (if (equal first second)
-                (progn
-                  (and (arrayp second) (clear-string second))
-                  (setq success first))
+                (prog1
+                  (setq success (copy-sequence first))
+                  (and (arrayp second) (clear-string second)))
               (and (arrayp first) (clear-string first))
               (and (arrayp second) (clear-string second))
               (message "Password not repeated accurately; please start over")
--
2.8.1

From 7124a681e17e4f33694e9f1c8ccb0261f6a0bf9c Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 9 May 2016 12:03:18 +0900
Subject: [PATCH 2/3] * lisp/subr.el (read-passwd): Clear also first password.

---
 lisp/subr.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/subr.el b/lisp/subr.el
index ef6af1d..5c32299 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2154,6 +2154,7 @@ read-passwd
             (if (equal first second)
                 (prog1
                   (setq success (copy-sequence first))
+                  (and (arrayp first) (clear-string first))
                   (and (arrayp second) (clear-string second)))
               (and (arrayp first) (clear-string first))
               (and (arrayp second) (clear-string second))
--
2.8.1

From e3aa5b5d30b901c2533538b3a9d0d5bd69493cf0 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 9 May 2016 12:08:02 +0900
Subject: [PATCH 3/3] * lisp/subr.el (read-passwd): Clear non-empty passwords.

---
 lisp/subr.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 5c32299..344c416 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2153,11 +2153,11 @@ read-passwd
                 (second (read-passwd "Confirm password: " nil default)))
             (if (equal first second)
                 (prog1
-                  (setq success (copy-sequence first))
-                  (and (arrayp first) (clear-string first))
-                  (and (arrayp second) (clear-string second)))
-              (and (arrayp first) (clear-string first))
-              (and (arrayp second) (clear-string second))
+                    (setq success (copy-sequence first))
+                  (when (and (arrayp first)
+                             (not (string= first "")))
+                    (clear-string first)
+                    (clear-string second)))
               (message "Password not repeated accurately; please start over")
               (sit-for 1))))
         success)
--
2.8.1






reply via email to

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