GNU bug report logs - #33731
26.1; cl-make-random-state copying not working

Previous Next

Package: emacs;

Reported by: Xu Chunyang <mail <at> xuchunyang.me>

Date: Thu, 13 Dec 2018 21:13:02 UTC

Severity: normal

Found in version 26.1

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33731 in the body.
You can then email your comments to 33731 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33731; Package emacs. (Thu, 13 Dec 2018 21:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xu Chunyang <mail <at> xuchunyang.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 13 Dec 2018 21:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xu Chunyang <mail <at> xuchunyang.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; cl-make-random-state copying not working
Date: Fri, 14 Dec 2018 05:12:35 +0800
Hi,

I am reading (info "(cl) Random Numbers") on cl-make-random-state. I
expect the following returns two equal numbers, because s should be a
copy of cl--random-state thus two cl-random should use two equal
state.

(let ((s (cl-make-random-state)))
  (list (cl-random 10000)
        (cl-random 10000 s)))
;; => (6955 916)

If I didn't misunderstand this, I think it is because
cl-make-random-state uses copy-tree, however it doesn't work for
cl-structure at least in Emacs 26.1, it doesn't copy at all.

(eq (cl-make-random-state 123)
    (cl-make-random-state 123))
;; => nil

(let* ((s1 (cl-make-random-state 123))
       (s2 (cl-make-random-state s1)))
  (eq s1 s2))
;; => t




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 19 Dec 2018 22:29:02 GMT) Full text and rfc822 format available.

Notification sent to Xu Chunyang <mail <at> xuchunyang.me>:
bug acknowledged by developer. (Wed, 19 Dec 2018 22:29:02 GMT) Full text and rfc822 format available.

Message #10 received at 33731-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 33731-done <at> debbugs.gnu.org
Subject: Fwd: 26.1; cl-make-random-state copying not working
Date: Wed, 19 Dec 2018 14:27:59 -0800
[Message part 1 (text/plain, inline)]
Thanks for reporting this bug; it is a regression introduced when we 
separated records from vectors. I installed the attached patch into the 
emacs-26 branch.


[0001-cl-make-random-state-was-not-copying-its-arg.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 17 Jan 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.