all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27617: 26.0.50; cl--random-state initialized to old-style vector
@ 2017-07-08 13:39 Christopher Wellons
  2017-07-10 18:56 ` bug#27617: [PATCH] Fix cl--random-state initialization Christopher Wellons
  2017-07-14  9:50 ` bug#27617: 26.0.50; cl--random-state initialized to old-style vector Paul Eggert
  0 siblings, 2 replies; 3+ messages in thread
From: Christopher Wellons @ 2017-07-08 13:39 UTC (permalink / raw
  To: 27617

The global variable cl--random-state is still being initialized to the 
old defstruct vector format. See lisp/emacs-lisp/cl-lib.el:296. This 
breaks all random number functions when the STATE argument isn't 
supplied:

    $ emacs -Q --batch -l cl-lib --eval '(cl-random 10)'
    Wrong type argument: cl--random-state, [cl--random-state-tag -1 30 ...]





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#27617: [PATCH] Fix cl--random-state initialization.
  2017-07-08 13:39 bug#27617: 26.0.50; cl--random-state initialized to old-style vector Christopher Wellons
@ 2017-07-10 18:56 ` Christopher Wellons
  2017-07-14  9:50 ` bug#27617: 26.0.50; cl--random-state initialized to old-style vector Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Christopher Wellons @ 2017-07-10 18:56 UTC (permalink / raw
  To: 27617

Here's a trivial patch that fixes this bug.

---
  lisp/emacs-lisp/cl-lib.el | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 936c852526c..ea47a0562ee 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -294,7 +294,7 @@ cl--random-time
      v))
  
  (defvar cl--random-state
-  (vector 'cl--random-state-tag -1 30 (cl--random-time)))
+  (record 'cl--random-state -1 30 (cl--random-time)))
  
  (defconst cl-most-positive-float nil
    "The largest value that a Lisp float can hold.
-- 
2.11.0






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#27617: 26.0.50; cl--random-state initialized to old-style vector
  2017-07-08 13:39 bug#27617: 26.0.50; cl--random-state initialized to old-style vector Christopher Wellons
  2017-07-10 18:56 ` bug#27617: [PATCH] Fix cl--random-state initialization Christopher Wellons
@ 2017-07-14  9:50 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2017-07-14  9:50 UTC (permalink / raw
  To: Christopher Wellons; +Cc: 27617-done

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Thanks for reporting that. I installed the attached, which differs from what you 
suggested but should also work.

[-- Attachment #2: 0001-Remove-duplicate-cl-random-state-definition.patch --]
[-- Type: text/x-patch, Size: 928 bytes --]

From 6443a95ad74d54b8be5ba85af9b893f3f1d5fa02 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 14 Jul 2017 02:47:30 -0700
Subject: [PATCH] Remove duplicate cl--random-state definition

* lisp/emacs-lisp/cl-lib.el (cl--random-state): Remove.
This variable is now defined in cl-extra.el (Bug#27617).
---
 lisp/emacs-lisp/cl-lib.el | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 936c852..3c9c622 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -293,9 +293,6 @@ cl--random-time
     (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
     v))
 
-(defvar cl--random-state
-  (vector 'cl--random-state-tag -1 30 (cl--random-time)))
-
 (defconst cl-most-positive-float nil
   "The largest value that a Lisp float can hold.
 If your system supports infinities, this is the largest finite value.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-14  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-08 13:39 bug#27617: 26.0.50; cl--random-state initialized to old-style vector Christopher Wellons
2017-07-10 18:56 ` bug#27617: [PATCH] Fix cl--random-state initialization Christopher Wellons
2017-07-14  9:50 ` bug#27617: 26.0.50; cl--random-state initialized to old-style vector Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.