GNU bug report logs -
#18361
New 'sort' implementation can crash Emacs
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Fri, 29 Aug 2014 21:26:01 UTC
Severity: minor
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 08/30/2014 03:07 AM, Paul Eggert wrote:
> Sure, a comparison function that returns a new random value every
> time you call it. Such a function is most likely not well formed
> that is, it most likely does not define a total order.
If an undefined behavior doesn't cause crash, I don't see a problem
if this is well-documented (probably in lispref).
I gave this function a solid run on GNU/Linux (glibc 2.18) and FreeBSD
10.0, and was unable to crash:
(defun sort-run ()
(interactive)
(let* ((max 1000000)
(size 1000)
(p (make-progress-reporter "Sorted: " 0 max)))
(dotimes (loops max)
(let ((v (make-vector size 0)))
(dotimes (i size) (aset v i (% (random) (* size 2))))
(sort v (lambda (x y) (random)))
(progress-reporter-update p loops)))
(progress-reporter-done p)))
I don't have any reasons to not trust in your experience, but I'm
really curious to look at the real example crashing qsort(_r) due
to ill-formed comparison function.
Dmitry
This bug report was last modified 10 years and 347 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.