From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0GMxGNHeK2GzRQEAgWs5BA (envelope-from ) for ; Sun, 29 Aug 2021 21:24:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MBqsE9HeK2GNGwAAbx9fmQ (envelope-from ) for ; Sun, 29 Aug 2021 19:24:01 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 14170D25C for ; Sun, 29 Aug 2021 21:24:01 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 1DD3E1FB5E; Sun, 29 Aug 2021 15:23:51 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id A92481FAE0 for ; Sun, 29 Aug 2021 15:23:46 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9D50D5FD5D; Sun, 29 Aug 2021 15:23:46 -0400 (EDT) Received: (nullmailer pid 4192495 invoked by uid 1000); Sun, 29 Aug 2021 19:23:39 -0000 From: David Bremner To: David Bremner , Tomi Ollila , Matt Armstrong , notmuch@notmuchmail.org Subject: [PATCH 6/9] emacs: wrap make-process Date: Sun, 29 Aug 2021 12:23:32 -0700 Message-Id: <20210829192335.4192305-7-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210829192335.4192305-1-david@tethera.net> References: <87tvgqzq1o.fsf@tethera.net> <20210829192335.4192305-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: Z4WCBNEV4OWBDXGONJWKCAD62BPSJGI5 X-Message-ID-Hash: Z4WCBNEV4OWBDXGONJWKCAD62BPSJGI5 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630265041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TBAAu/VIJTZZb88ffJPvWdtq5orCFTowkxMhPzjxepY=; b=DPol7fasDx6ThkWnfXNS58ej97Yj1o6qxPiDUSmhG6mgQrMZAWqLnLY3cTWw+IlLaxD7Xg mHnqZnxjYO9QpJQ2DmOn8mLrp8d8sGL7yarh03rz3QDyW5X0wKCJKvJfJ/Gp5dN/5E7+2T 2BjpyBsWAqnknCqoF+C58tZoexJdJojN1neLSpF1pE+cBI27p1cKESaBy0TcVaaE0JYatp yacAyuSU3bf+xEXxSIgL9qtcannHRdTeGGm5gyuIoNlFL5LNDUbiHaXJNJmyMfZo9JAknt XFQvGg9j7gAVIYHoi2izJGcGGGV4Uh+NyXLseYfkcYrxuQ5ptBNHtw+UJ/9FQQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630265041; a=rsa-sha256; cv=none; b=UrcabxYU3pyrTrQ3Pt9yBca9yCpjHW8M8VqVA5R+yVVIePYQym9mR1SdhUODg2x782seqH 7d88RAnrKoLfJ13sUB7JBLCbglOVCOtzFg9ga7VjhYa33AHkAcmQWIFzCkaZUWME/nStTR OKEcghwcxm/HJnsQ4BjjAeJHsY9ZCyWET65t38BCl3dD7ORT4i12NKYxUeygbMgWhAFPzl m6b3vBpVb23nER+RTgeg4Me2YQSu0Z0OdJFa9jem7jr32LtwVVIGia5cCDltp7/mvFUE2m G5ius9nR5Y6zGTeuB9QjAIJGnbtmz22x1lGZda+6LFAFCX6F+daV8QRKqhKkcg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.99 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 14170D25C X-Spam-Score: -0.99 X-Migadu-Scanner: scn0.migadu.com X-TUID: hHhYMqKDbHmu Provide a safe working directory. --- emacs/notmuch-crypto.el | 2 +- emacs/notmuch-lib.el | 7 ++++++- test/T310-emacs.sh | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index de4d9aea..3ffb5654 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -224,7 +224,7 @@ corresponding key when the status button is pressed." (with-current-buffer buffer (goto-char (point-max)) (insert (format "--- Retrieving key %s:\n" keyid))) - (let ((p (make-process + (let ((p (notmuch--make-process :name "notmuch GPG key retrieval" :connection-type 'pipe :buffer buffer diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 207ea4c2..9693185f 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -869,6 +869,11 @@ You may need to restart Emacs or upgrade your notmuch package.")) default" (notmuch--apply-with-env #'process-lines program args)) +(defun notmuch--make-process (&rest args) + "Wrap make-process, binding DEFAULT-DIRECTORY to a safe +default" + (notmuch--apply-with-env #'make-process args)) + (defun notmuch--call-process-region (start end program &optional delete buffer display &rest args) @@ -950,7 +955,7 @@ status." (let* ((command (or (executable-find notmuch-command) (error "Command not found: %s" notmuch-command))) (err-buffer (generate-new-buffer " *notmuch-stderr*")) - (proc (make-process + (proc (notmuch--make-process :name name :buffer buffer :command (cons command args) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 3434fd0b..fd0ea11d 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -1155,7 +1155,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch-search with nonexistent CWD" -test_subtest_known_broken test_emacs '(test-log-error (let ((default-directory "/nonexistent")) (notmuch-search "*")))' -- 2.33.0