File: 0007-Kill-gpg-agent-in-package-test.el-to-avoid-a-race.patch

package info (click to toggle)
emacs25 25.1%2B1-4%2Bdeb9u1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 131,428 kB
  • ctags: 97,538
  • sloc: lisp: 1,107,716; ansic: 305,108; objc: 16,577; makefile: 5,931; sh: 2,547; perl: 1,567; yacc: 1,566; cpp: 1,287; xml: 1,110; php: 1,035; pascal: 1,011; python: 831; cs: 770; ada: 725; awk: 640; ruby: 396; erlang: 153; java: 27
file content (41 lines) | stat: -rw-r--r-- 1,886 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From c7e8cdc2eee113bf6d49f25c1ef6d9ef02f8f94b Mon Sep 17 00:00:00 2001
From: Rob Browning <rlb@defaultvalue.org>
Date: Mon, 10 Oct 2016 17:35:56 -0500
Subject: Kill gpg agent in package-test.el to avoid a race

package-test.el should no longer fail during clean up.

* Previously a delete-directories call raced with the gpg agent's own
  cleanup process (presumably triggered by the first deletion of one of
  the agent's sockets).  As a result, it looks like the agent might
  delete one of its sockets after delete-directories had decided to
  delete the socket, but before it made the attempt, causing an
  exception.

* To fix the problem, explicitly ask gpg-connect-agent to kill the agent
  before attempting to delete the gnupg home directory, and then delete
  via "rm -rf" to ignore any vanishing files.
---
 test/automated/package-test.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/automated/package-test.el b/test/automated/package-test.el
index c4c856f3031..d0719588c89 100644
--- a/test/automated/package-test.el
+++ b/test/automated/package-test.el
@@ -149,7 +149,14 @@ package-test-fake-contents-file
                ,@body)))
 
        (when (file-directory-p package-test-user-dir)
-         (delete-directory package-test-user-dir t))
+         (call-process "gpg-connect-agent" nil nil nil
+                       "--homedir" (concat package-test-user-dir "/gnupg")
+                       "--no-autostart"
+                       "killagent" "/bye")
+         ;; Call "rm -rf" instead of delete-directory so that it won't
+         ;; choke if the gpg-agent sockets disappear during the
+         ;; recursive traversal.
+         (call-process "rm" nil nil nil "-r" package-test-user-dir))
 
        (when (and (boundp 'package-test-archive-upload-base)
                   (file-directory-p package-test-archive-upload-base))