GNU bug report logs - #33984
26.1; fortune-compile does not search exec-path for strfile program

Previous Next

Package: emacs;

Reported by: "Benjamin Ragheb" <ben <at> benzado.com>

Date: Sat, 5 Jan 2019 03:01:01 UTC

Severity: minor

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33984 in the body.
You can then email your comments to 33984 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33984; Package emacs. (Sat, 05 Jan 2019 03:01:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Benjamin Ragheb" <ben <at> benzado.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 Jan 2019 03:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Benjamin Ragheb" <ben <at> benzado.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; fortune-compile does not search exec-path for strfile program
Date: Fri, 04 Jan 2019 21:54:28 -0500
[Message part 1 (text/plain, inline)]
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.
[fortune.el.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33984; Package emacs. (Tue, 09 Jul 2019 22:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 33984 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Benjamin Ragheb" <ben <at> benzado.com>
Cc: 33984 <at> debbugs.gnu.org
Subject: Re: bug#33984: 26.1;
 fortune-compile does not search exec-path for strfile program
Date: Wed, 10 Jul 2019 00:32:28 +0200
"Benjamin Ragheb" <ben <at> benzado.com> writes:

> 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.

Makes sense.

> 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.

Yeah, that would be better, but would be incompatible as you say.

> -			(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

I've now applied this patch to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 22:33:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 33984 <at> debbugs.gnu.org and "Benjamin Ragheb" <ben <at> benzado.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 22:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Aug 2019 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.