From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Benjamin Ragheb" Newsgroups: gmane.emacs.bugs Subject: bug#33984: 26.1; fortune-compile does not search exec-path for strfile program Date: Fri, 04 Jan 2019 21:54:28 -0500 Message-ID: NNTP-Posting-Host: blaine.gmane.org Content-Type: multipart/mixed; boundary=4cc081f71e8b483f9f98b6088de6b3fb X-Trace: blaine.gmane.org 1546657151 28758 195.159.176.226 (5 Jan 2019 02:59:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 5 Jan 2019 02:59:11 +0000 (UTC) User-Agent: Cyrus-JMAP/3.1.5-739-g7452a1e-fmstable-20190103v1 To: 33984@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 05 03:59:07 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from listsout.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfcB0-0007Ks-Fc for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Jan 2019 03:59:06 +0100 Original-Received: from localhost ([127.0.0.1]:47606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfcD6-000717-RQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Jan 2019 22:01:16 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:54958 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfcCy-00070y-Ny for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 22:01:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfcCt-00072q-Kf for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 22:01:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gfcCs-00072B-7D for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 22:01:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gfcCr-0005IU-TD for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 22:01:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Benjamin Ragheb" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jan 2019 03:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33984 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154665725020335 (code B ref -1); Sat, 05 Jan 2019 03:01:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jan 2019 03:00:50 +0000 Original-Received: from localhost ([127.0.0.1]:47162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfcCg-0005Hv-BR for submit@debbugs.gnu.org; Fri, 04 Jan 2019 22:00:50 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:40737) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gfc6g-000584-Bj for submit@debbugs.gnu.org; Fri, 04 Jan 2019 21:54:38 -0500 Original-Received: from [209.51.188.17] (port=39399 helo=lists.gnu.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gfc6f-0003fg-Nx for submit@debbugs.gnu.org; Fri, 04 Jan 2019 21:54:37 -0500 Original-Received: from eggsout.gnu.org ([209.51.188.92]:54520 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfc6e-00061h-KB for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 21:54:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfc6a-0003dA-8W for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 21:54:36 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40101) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gfc6Z-0003c1-Vz for bug-gnu-emacs@gnu.org; Fri, 04 Jan 2019 21:54:32 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6BC9323152 for ; Fri, 4 Jan 2019 21:54:29 -0500 (EST) Original-Received: from imap22 ([10.202.2.72]) by compute1.internal (MEProxy); Fri, 04 Jan 2019 21:54:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benzado.com; h= message-id:date:from:to:subject:content-type; s=mesmtp; bh=UZCHr pEIxpY2cFvgbq6+Zf9RfDXrJsaAGNzixHcGlWY=; b=U9DxuqpI5zFacxSaVu9D+ zUe12pT08zUCimxc5n7SRZiztwnRBavePR0dU+tvH6v2LwWUHWCgMrcgsRiNzv9l 6c0cnMPyofUtkY58UCPxxk/xA14NQ3dfxK4podWqx2t1v6rJRG2Q61+tcikWVZ5k B4cI1Utz4lh3L5y9PyF32k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id:subject :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=UZCHrpEIxpY2cFvgbq6+Zf9RfDXrJsaAGNzixHcGlWY=; b=RYfQB3iV IWm8XEC2lvoOnARCWltBXOLMP2GwG848MU4eCvvzsZGefLLmg5fCY/zAIRETN4qZ 3Fv36IjA+vO/aCs7stXn4mV9HbXOg2Im7YHUuYI0CewvyBPmaeWZGcrVMPhlk+3V HGQMLwWntHXsVm5/myNHu4r+j8B9dvL/CDk1Mr9Q7sZB6ubXcVPd87ZNGJoN1ICW mzGr6BXx1in+7yniA8bkS6q/PIeR3xl8v2MqqUcrgf6OHpx9xvh8mhntdXO5oW4j TSoOk0RRDi8hgdOwwy75gEsH1Dj7nm8b9krGAg8/iCEhCCe8GN6/qRn+eOxRXd2E 4seS4ziVgldnXQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrvddvgdehgeculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgfkfffhvffutgesmhdtreerre ertdenucfhrhhomhepfdeuvghnjhgrmhhinhcutfgrghhhvggsfdcuoegsvghnsegsvghn iigrughordgtohhmqeenucfrrghrrghmpehmrghilhhfrhhomhepsggvnhessggvnhiirg guohdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id E4AB8E64B; Fri, 4 Jan 2019 21:54:28 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Me-Personality: 62235657 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Fri, 04 Jan 2019 22:00:49 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154149 Archived-At: --4cc081f71e8b483f9f98b6088de6b3fb Content-Type: text/plain I am using Emacs 26.1 on macOS 10.14.2 Mojave. macOS does not include the fortune or strfile programs, so I install them using MacPorts, which places them in /opt/local/bin. By default, that directory is not on the PATH, so I have the following line in init.el: (add-to-list 'exec-path "/opt/local/bin") With this setup, running M-x fortune works as expected (because the fortune command uses call-process to invoke the fortune program). However, M-x fortune-compile fails with this error: /bin/bash: strfile: command not found I have determined this is because fortune-compile passes the value of the fortune-strfile variable directly to shell-command, which does not consult exec-path. I have attached a patch which corrects this problem by using executable-find before calling shell-command. If strfile cannot be found, it signals an error. I tried to keep the patch as small as possible, and resisted the temptation to replace the call to shell-command with call-process. Doing so would have broken compatibility with the fortune-quiet-strfile-options variable, which people may have customized. --4cc081f71e8b483f9f98b6088de6b3fb Content-Disposition: attachment;filename="fortune.el.patch" Content-Type: application/octet-stream; name="fortune.el.patch" Content-Transfer-Encoding: 7BIT --- fortune.el.master 2019-01-04 20:37:38.000000000 -0500 +++ fortune.el.strfile-fix 2019-01-04 21:12:09.000000000 -0500 @@ -244,12 +244,14 @@ (let* ((fortune-file (expand-file-name (substitute-in-file-name file))) (fortune-dat (expand-file-name (substitute-in-file-name - (concat fortune-file fortune-database-extension))))) + (concat fortune-file fortune-database-extension)))) + (strfile (or (executable-find fortune-strfile) + (error "Can't find strfile program %s" fortune-strfile))) (cond ((file-exists-p fortune-file) (cond ((file-newer-than-file-p fortune-file fortune-dat) (message "Compiling new fortune database %s" fortune-dat) (shell-command - (concat fortune-strfile fortune-strfile-options + (concat strfile fortune-strfile-options " " fortune-file fortune-quiet-strfile-options))))) (t (error "Can't compile fortune file %s" fortune-file))))) --4cc081f71e8b483f9f98b6088de6b3fb--