commit a37eba849eddc41375ad73974f6fcb1258aa8eba (HEAD, refs/remotes/origin/master) Author: Daniel Colascione Date: Thu Oct 6 12:46:36 2016 -0700 Speed up initialization by preferring /dev/urandom to GnuTLS * src/sysdep.c (init_random): Try /dev/urandom before GnuTLS. diff --git a/src/sysdep.c b/src/sysdep.c index 0121f01..55d29bc 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2188,27 +2188,35 @@ void init_random (void) { random_seed v; - if (! (EQ (emacs_gnutls_global_init (), Qt) - && gnutls_rnd (GNUTLS_RND_NONCE, &v, sizeof v) == 0)) - { - bool success = false; -#ifndef WINDOWSNT - int fd = emacs_open ("/dev/urandom", O_RDONLY, 0); - if (0 <= fd) - { - success = emacs_read (fd, &v, sizeof v) == sizeof v; - emacs_close (fd); - } + bool success = false; + + /* First, try seeding the PRNG from the operating system's entropy + source. This approach is both fast and secure. */ +#ifdef WINDOWSNT + success = w32_init_random (&v, sizeof v) == 0; #else - success = w32_init_random (&v, sizeof v) == 0; + int fd = emacs_open ("/dev/urandom", O_RDONLY, 0); + if (0 <= fd) + { + success = emacs_read (fd, &v, sizeof v) == sizeof v; + close (fd); + } #endif - if (! success) - { - /* Fall back to current time value + PID. */ - struct timespec t = current_timespec (); - v = getpid () ^ t.tv_sec ^ t.tv_nsec; - } + + /* If that didn't work, try using GnuTLS, which is secure, but on + some systems, can be somewhat slow. */ + if (!success) + success = EQ (emacs_gnutls_global_init (), Qt) + && gnutls_rnd (GNUTLS_RND_NONCE, &v, sizeof v) == 0; + + /* If _that_ didn't work, just use the current time value and PID. + It's at least better than XKCD 221. */ + if (!success) + { + struct timespec t = current_timespec (); + v = getpid () ^ t.tv_sec ^ t.tv_nsec; } + set_random_seed (v); } commit 27443df092bfb4ada559f8fc024e01f174a5bcb0 Author: José L. Doménech Date: Sat Oct 29 21:18:31 2016 -0400 Quote file names in dired compression commands * lisp/dired-aux.el (dired-do-compress-to): Change the string used as shell command for compression by quoting the filenames used for input and output (Bug #24620). diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d25352e..972b6b1 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1012,11 +1012,13 @@ and `dired-compress-files-alist'." (t (when (zerop (dired-shell-command - (replace-regexp-in-string - "%o" out-file - (replace-regexp-in-string - "%i" (mapconcat #'file-name-nondirectory in-files " ") - (cdr rule))))) + (format-spec (cdr rule) + `((?\o . ,(shell-quote-argument out-file)) + (?\i . ,(mapconcat + (lambda (file-desc) + (shell-quote-argument (file-name-nondirectory + file-desc))) + in-files " ")))))) (message "Compressed %d file(s) to %s" (length in-files) (file-name-nondirectory out-file))))))) commit 966b73b3163416adf09bcff7418ecc9fa5a554c9 Author: Eli Zaretskii Date: Sat Oct 29 17:39:54 2016 +0300 Avoid errors in posn-at-point for large images * src/keyboard.c (Fposn_at_point): If pos-visible-in-window-p returns a 6-member list for a partially visible glyph, pass the sum of Y and RTOP to posn-at-x-y, since that's where the visible portion of that glyph begins on display. (Bug#24804) (Bug#21832) (Bug#23809) diff --git a/src/keyboard.c b/src/keyboard.c index bb411e7..65938a5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10790,11 +10790,19 @@ The `posn-' functions access elements of such lists. */) { Lisp_Object x = XCAR (tem); Lisp_Object y = XCAR (XCDR (tem)); + Lisp_Object aux_info = XCDR (XCDR (tem)); + int y_coord = XINT (y); /* Point invisible due to hscrolling? X can be -1 when a newline in a R2L line overflows into the left fringe. */ if (XINT (x) < -1) return Qnil; + if (!NILP (aux_info) && y_coord < 0) + { + int rtop = XINT (XCAR (aux_info)); + + y = make_number (y_coord + rtop); + } tem = Fposn_at_x_y (x, y, window, Qnil); }