From: Mark Wooding Date: Mon, 13 Apr 2020 14:16:56 +0000 (+0100) Subject: el/dot-emacs.el: Remove `noip' from `LD_PRELOAD' list while running `man'. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/234ade9da911fef971e2938bbf23c322bcdff148 el/dot-emacs.el: Remove `noip' from `LD_PRELOAD' list while running `man'. Later versions of `man-db' install a `seccomp' filter to prevent stray manpages from (among other stuff) doing network things. This interacts badly with `noip', which wants to fetch the list of network interfaces at startup. Since the `man-db' filter is strictly better than what `noip' is doing, just turn off `noip' while running `man'. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index d2b9dcc..5bba5d7 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -4441,6 +4441,41 @@ there is sadness." (set-window-dedicated-p (or window (selected-window)) nil)) ;;;-------------------------------------------------------------------------- +;;; Man pages. + +;; Turn off `noip' when running `man': it interferes with `man-db''s own +;; seccomp(2)-based sandboxing, which is (in this case, at least) strictly +;; better. +(defadvice Man-getpage-in-background + (around mdw-inhibit-noip (topic) compile activate) + "Inhibit the `noip' preload hack when invoking `man'." + (let* ((old-preload (getenv "LD_PRELOAD")) + (preloads (save-match-data (split-string old-preload ":"))) + (any nil) + (filtered nil)) + (while preloads + (let ((item (pop preloads))) + (if (save-match-data + (string-match "\\(/\\|^\\)noip\.so\\(:\\|$\\)" item)) + (setq any t) + (push item filtered)))) + (if any + (unwind-protect + (progn + (setenv "LD_PRELOAD" + (and filtered + (with-output-to-string + (setq filtered (nreverse filtered)) + (let ((first t)) + (while filtered + (if first (setq first nil) + (write-char ?:)) + (write-string (pop filtered))))))) + ad-do-it) + (setenv "LD_PRELOAD" old-preload)) + ad-do-it))) + +;;;-------------------------------------------------------------------------- ;;; MPC configuration. (eval-when-compile (trap (require 'mpc)))