GNU bug report logs - #30063
26.0.90; Silent fail with `rst-compile-pdf-preview'

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> gmail.com>

Date: Wed, 10 Jan 2018 13:58:01 UTC

Severity: minor

Found in version 26.0.90

Done: Simen Heggestøyl <simenheg <at> gmail.com>

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 30063 in the body.
You can then email your comments to 30063 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#30063; Package emacs. (Wed, 10 Jan 2018 13:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simen Heggestøyl <simenheg <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 10 Jan 2018 13:58:02 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org, stefan <at> merten-home.de
Subject: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Wed, 10 Jan 2018 14:57:18 +0100
If either of the `xpdf' or `rst2pdf' programs are missing,
`rst-compile-pdf-preview' fails without leaving any message. It would be
useful if the command informed the user what's stopping it from working.

-- Simen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Sat, 27 Jan 2018 12:01:01 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: 30063 <at> debbugs.gnu.org, stefan <at> merten-home.de
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Sat, 27 Jan 2018 12:59:55 +0100
[Message part 1 (text/plain, inline)]
How about something like the attached patch?

-- Simen
[Message part 2 (text/html, inline)]
[0001-Warn-about-missing-executables-in-RST-PDF-preview.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Sun, 28 Jan 2018 18:12:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Sun, 28 Jan 2018 13:11:34 -0500
Simen Heggestøyl <simenheg <at> gmail.com> writes:

>  	 (command (format "%s %s %s && %s %s ; rm %s"
> +			  pdf-compile-program
>  			  buffer-file-name tmp-filename
>  			  rst-pdf-program tmp-filename tmp-filename)))
> +    (unless (executable-find pdf-compile-program)
> +      (error "Cannot find executable `%s'" pdf-compile-program))
> +    (unless (executable-find rst-pdf-program)
> +      (error "Cannot find executable `%s'" rst-pdf-program))

It's possible to have PATH and exec-path desynchronized, such that the
above code could throw an error even though the
start-process-shell-command call later would succeed.  Maybe we should
should just consider that a misconfiguration on the user's part though.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Mon, 29 Jan 2018 17:44:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org,
 Simen Heggestøyl <simenheg <at> gmail.com>
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Mon, 29 Jan 2018 12:43:39 -0500
Noam Postavsky wrote:

> Simen Heggestøyl <simenheg <at> gmail.com> writes:
>
>>  	 (command (format "%s %s %s && %s %s ; rm %s"
>> +			  pdf-compile-program
>>  			  buffer-file-name tmp-filename
>>  			  rst-pdf-program tmp-filename tmp-filename)))
>> +    (unless (executable-find pdf-compile-program)
>> +      (error "Cannot find executable `%s'" pdf-compile-program))
>> +    (unless (executable-find rst-pdf-program)
>> +      (error "Cannot find executable `%s'" rst-pdf-program))
>
> It's possible to have PATH and exec-path desynchronized, such that the
> above code could throw an error even though the
> start-process-shell-command call later would succeed.  Maybe we should
> should just consider that a misconfiguration on the user's part though.

Yes, I think PATH != exec-path is a user error.

BTW what happens with the above if the program is present, but fails for
some reason? Is nothing still shown to the user in that case?

Also, does it actually need to go through the shell?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Tue, 30 Jan 2018 13:50:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org, simenheg <at> gmail.com
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Tue, 30 Jan 2018 15:49:47 +0200
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Sun, 28 Jan 2018 13:11:34 -0500
> Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org
> 
> Simen Heggestøyl <simenheg <at> gmail.com> writes:
> 
> >  	 (command (format "%s %s %s && %s %s ; rm %s"
> > +			  pdf-compile-program
> >  			  buffer-file-name tmp-filename
> >  			  rst-pdf-program tmp-filename tmp-filename)))
> > +    (unless (executable-find pdf-compile-program)
> > +      (error "Cannot find executable `%s'" pdf-compile-program))
> > +    (unless (executable-find rst-pdf-program)
> > +      (error "Cannot find executable `%s'" rst-pdf-program))
> 
> It's possible to have PATH and exec-path desynchronized, such that the
> above code could throw an error even though the
> start-process-shell-command call later would succeed.  Maybe we should
> should just consider that a misconfiguration on the user's part though.

Yes, we could do that.  But can we signal an error only when the
command fails?  That should minimize false negatives.

Also please note that the shell command as written is unportable: the
";" part will not work on MS-Windows, we need to use "&" instead.  But
that's a separate issue.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Tue, 30 Jan 2018 14:31:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org,
 Simen Heggestøyl <simenheg <at> gmail.com>
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Tue, 30 Jan 2018 09:30:30 -0500
On Tue, Jan 30, 2018 at 8:49 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:

> Yes, we could do that.  But can we signal an error only when the
> command fails?  That should minimize false negatives.

I think it's a bit tricky due to being asynchronous, though it should be doable.

> Also please note that the shell command as written is unportable: the
> ";" part will not work on MS-Windows, we need to use "&" instead.  But
> that's a separate issue.

"&" would do the wrong thing for a POSIX sh compatible shell, so the
only way to fix that would be to avoid the shell entirely like Glenn
hinted at.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Tue, 30 Jan 2018 15:41:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org, simenheg <at> gmail.com
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Tue, 30 Jan 2018 17:40:58 +0200
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Tue, 30 Jan 2018 09:30:30 -0500
> Cc: Simen Heggestøyl <simenheg <at> gmail.com>, 
> 	stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org
> 
> > Also please note that the shell command as written is unportable: the
> > ";" part will not work on MS-Windows, we need to use "&" instead.  But
> > that's a separate issue.
> 
> "&" would do the wrong thing for a POSIX sh compatible shell

I meant to leave ";" on Posix, and use "&" on Windows.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Sun, 29 Sep 2019 12:10:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: stefan <at> merten-home.de, 30063 <at> debbugs.gnu.org
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Sun, 29 Sep 2019 14:09:06 +0200
Simen Heggestøyl <simenheg <at> gmail.com> writes:

> * lisp/textmodes/rst.el (rst-compile-pdf-preview): Warn about missing
> executables when attempting to compile and preview an RST file as PDF.
> (Bug#30218)

[...]

> +    (unless (executable-find pdf-compile-program)
> +      (error "Cannot find executable `%s'" pdf-compile-program))
> +    (unless (executable-find rst-pdf-program)
> +      (error "Cannot find executable `%s'" rst-pdf-program))

Others pointed out that it might be nice to report error messages back
from the pdf commands, and that's true, but I think this patch makes
sense, too, because it gives good, early feedback on a likely problem,
so I think it should be applied.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Thu, 03 Oct 2019 21:11:02 GMT) Full text and rfc822 format available.

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

From: Stefan Merten <stefan <at> merten-home.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 30063 <at> debbugs.gnu.org,
 Simen Heggestøyl <simenheg <at> gmail.com>
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Thu, 03 Oct 2019 22:53:43 +0200
Hi all!

Sorry for not looking into this for so long. This whole part of
`rst.el' needs a couple of improvements. I did not write this code and
frankly did not care much about it - besides adding some FIXMEs.

4 days ago Lars Ingebrigtsen wrote:
> Simen Heggestøyl <simenheg <at> gmail.com> writes:
> 
>> * lisp/textmodes/rst.el (rst-compile-pdf-preview): Warn about missing
>> executables when attempting to compile and preview an RST file as PDF.
>> (Bug#30218)
> 
> [...]
> 
>> +    (unless (executable-find pdf-compile-program)
>> +      (error "Cannot find executable `%s'" pdf-compile-program))
>> +    (unless (executable-find rst-pdf-program)
>> +      (error "Cannot find executable `%s'" rst-pdf-program))
> 
> Others pointed out that it might be nice to report error messages back
> from the pdf commands, and that's true, but I think this patch makes
> sense, too, because it gives good, early feedback on a likely problem,
> so I think it should be applied.

Well, IMHO this patch would be less than optimal. There is already

      (defcustom rst-compile-toolsets ...)

There is an `executable-find' already for the default values. Although
it only takes an alternative if it doesn't find the first guess. This
is also less than optimal :-( .

`rst-pdf-program' on the other hand is not yet integrated in
`rst-compile-toolsets'. This is a necessary improvement.


A good solution IMHO would be to have a reasonable list of defaults
for (all) the executables in `rst-compile-toolsets', then check this
list of defaults for executability and then set the default
customization accordingly. If none of the defaults is found the
customization for the respective symbol should be set to nil and the
error should appear when the executable is to be used.

[...browsing through the code...]

Ok, a sensible solution would need quite an effort. So it's probably
best to apply this patch now and when at any point in the future I
come up with a more general solution it will do something equivalent
or rather something better.


						Grüße

						Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30063; Package emacs. (Mon, 07 Oct 2019 03:27:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Merten <stefan <at> merten-home.de>
Cc: 30063 <at> debbugs.gnu.org,
 Simen Heggestøyl <simenheg <at> gmail.com>
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Mon, 07 Oct 2019 05:25:58 +0200
Stefan Merten <stefan <at> merten-home.de> writes:

> A good solution IMHO would be to have a reasonable list of defaults
> for (all) the executables in `rst-compile-toolsets', then check this
> list of defaults for executability and then set the default
> customization accordingly. If none of the defaults is found the
> customization for the respective symbol should be set to nil and the
> error should appear when the executable is to be used.

Yeah, that sounds like a good thing.

> [...browsing through the code...]
>
> Ok, a sensible solution would need quite an effort. So it's probably
> best to apply this patch now and when at any point in the future I
> come up with a more general solution it will do something equivalent
> or rather something better.

OK, Simen -- I think you should just apply the patch and close the bug
report, and we can hope that further improvements arrive in the future.
:-)

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




Reply sent to Simen Heggestøyl <simenheg <at> gmail.com>:
You have taken responsibility. (Wed, 09 Oct 2019 16:14:02 GMT) Full text and rfc822 format available.

Notification sent to Simen Heggestøyl <simenheg <at> gmail.com>:
bug acknowledged by developer. (Wed, 09 Oct 2019 16:14:02 GMT) Full text and rfc822 format available.

Message #37 received at 30063-done <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: stefan <at> merten-home.de, 30063-done <at> debbugs.gnu.org
Subject: Re: bug#30063: 26.0.90; Silent fail with `rst-compile-pdf-preview'
Date: Wed, 09 Oct 2019 18:13:35 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> OK, Simen -- I think you should just apply the patch and close the bug
> report, and we can hope that further improvements arrive in the future.
> :-)

Alright, applied!

-- Simen




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

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

Previous Next


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