Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH 1/4] elisp-common.eclass: Add timeout to version detection
Date: Thu, 15 Apr 2021 06:36:08
Message-Id: 20210415063543.28602-1-ulm@gentoo.org
1 Signed-off-by: Ulrich Müller <ulm@g.o>
2 ---
3 eclass/elisp-common.eclass | 6 ++++--
4 1 file changed, 4 insertions(+), 2 deletions(-)
5
6 diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
7 index 832fc19e4675..bdf97f413033 100644
8 --- a/eclass/elisp-common.eclass
9 +++ b/eclass/elisp-common.eclass
10 @@ -219,7 +219,9 @@ _ELISP_EMACS_VERSION=""
11 # Output version of currently active Emacs.
12
13 elisp-emacs-version() {
14 - local version ret
15 + local version ret tmout="timeout -k 5 55"
16 + # Run without timeout if the command is not available
17 + ${tmout} true &>/dev/null || tmout=""
18 # The following will work for at least versions 18-24.
19 echo "(princ emacs-version)" >"${T}"/emacs-version.el
20 version=$(
21 @@ -228,7 +230,7 @@ elisp-emacs-version() {
22 # Redirecting stdin and unsetting TERM and DISPLAY will cause
23 # most of them to exit with an error.
24 unset TERM DISPLAY
25 - ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
26 + ${tmout} ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
27 )
28 ret=$?
29 rm -f "${T}"/emacs-version.el
30 --
31 2.31.1

Replies