[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30626: 26.0.91; Crash when traversing a `stream-of-directory-files'
From: |
Noam Postavsky |
Subject: |
bug#30626: 26.0.91; Crash when traversing a `stream-of-directory-files' |
Date: |
Sat, 25 May 2019 16:29:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
tags 30626 + patch
quit
Michael Heerdegen <michael_heerdegen@web.de> writes:
>> > - stream-make should use cons instead of list (or maybe a struct?).
>>
>> I think cons would be ok. Would a struct make things slower?
A struct might be slower, and cons has the advantage that the print
output is more readable for humans too. E.g., with this code:
(let ((s (stream-range 1 5)))
(stream-flush s)
s)
;; Using cons (patch in this message):
(--stream-evald-- 1 --stream-evald-- 2 --stream-evald-- 3 --stream-evald-- 4
--stream-evald--)
;; Using list (previous patch):
(--stream-evald-- (1 --stream-evald-- (2 --stream-evald-- (3 --stream-evald--
(4 --stream-evald-- nil)))))
;; I guess using a struct would look something like this:
#(--stream-evald-- (1 . #(--stream-evald-- (2 . #(--stream-evald-- (3 .
#(--stream-evald-- (4 . #(--stream-evald-- nil)))))))))
;; Using list with thunk (current, v2.2.4)
(--stream-- #[256 "\211\203\007\0\303\242\207\303\242\204
\0\304\300\242\305\300\242\302\242\\\301\302\242#B\240\210\303\306\240\210\304\242\207"
[(1) 5 (1) (t) ((1 --stream-- #[256 "\211\203\007\0\303\242\207\303\242\204
\0\304\300\242\305\300\242\302\242\\\301\302\242#B\240\210\303\306\240\210\304\242\207"
[(2) 5 (1) (t) ((2 --stream-- #[256 "\211\203\007\0\303\242\207\303\242\204
\0\304\300\242\305\300\242\302\242\\\301\302\242#B\240\210\303\306\240\210\304\242\207"
[(3) 5 (1) (t) ((3 --stream-- #[256 "\211\203\007\0\303\242\207\303\242\204
\0\304\300\242\305\300\242\302\242\\\301\302\242#B\240\210\303\306\240\210\304\242\207"
[(4) 5 (1) (t) ((4 --stream-- #[256
"\211\203\007\0\300\242\207\300\242\204\024\0\301\302\240\210\300\303\240\210\301\242\207"
[(t) (nil) nil t] 3 "
(fn &optional CHECK)"])) stream-range t] 7 "
(fn &optional CHECK)"])) stream-range t] 7 "
(fn &optional CHECK)"])) stream-range t] 7 "
(fn &optional CHECK)"])) stream-range t] 7 "
(fn &optional CHECK)"])
>> > - stream-empty should just be a constant.
>>
>> Dunno if there are cases where this would be problematic, but I guess we
>> could do this as well.
I've done this in the patch below. Passes all the tests, and I can't
see why it would be problematic.
> @Nicolas: Do you want us to care about this or do you want to have a
> look yourself? I don't want to hurry, I just don't want this to be
> forgotten. If you say you have time in four months, it's still ok.
Not getting any response; I'll wait another week for comments and then
push.
0001-Drop-forced-lambda-s-from-stream-Bug-30626.patch
Description: patch