unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41065: Result of byte-compilation can be nil even if the compiled file contains no errors
@ 2020-05-03 22:21 Paul Pogonyshev
  2020-10-27  0:10 ` bug#41065: PATCH Paul Pogonyshev
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Pogonyshev @ 2020-05-03 22:21 UTC (permalink / raw)
  To: 41065

[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]

To reproduce, save this as file `main.el':

    (eval-when-compile
      (let ((default-directory (expand-file-name "/tmp/myprivatelib/")))
        (make-directory default-directory t)
        (with-temp-file "thelib.el"
          (insert "(defun im-a-library-function ()\n"
                  "  (trigger-a-warning-here-1))\n"
                  "(provide 'thelib\n"))  ; <- intentionally erroneous
syntax
        (byte-compile-file "thelib.el")))

    (defun blabla ()
      (trigger-a-warning-here-2))

and execute:

    $ emacs --batch --eval "(print (byte-compile-file \"main.el\"))"

Result is:

    In toplevel form:
    thelib.el:3:1: Error: End of file during parsing

    In end of data:
    ~/test/nested-compilation/main.el:12:1: Warning: the function
        ‘trigger-a-warning-here-2’ is not known to be defined.

    nil

The last line is the result of the call to `byte-compile-file'
from the command line and it is nil.  But this is wrong, because
`main.el' is syntactically correct and never triggers an error:
you can verify this by evaluating `let' form manually.  What
failed is the "inner" compilation, but it must not affect the
result of the "main" compilation process.

A smaller problem is that the path to `main.el' is written fully,
because it is apparently found from `/tmp/myprivatelib', which
further corroborates my guess that the two byte-compilation
processes are improperly lumped together.

If you fix generated `thelib.el' by adding the missing paren,
"outer" compilation will succeed.

I emailed this to to `emacs-devel' quite a while ago:

    https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg00227.html

and the answer from Stefan Monnier confirmed that this should be
qualified as a bug.  I have forgotten to resubmit this to
`bug-gnu-emacs' until now.

Paul

[-- Attachment #2: Type: text/html, Size: 2308 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-27  8:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-03 22:21 bug#41065: Result of byte-compilation can be nil even if the compiled file contains no errors Paul Pogonyshev
2020-10-27  0:10 ` bug#41065: PATCH Paul Pogonyshev
2020-10-27  8:47   ` bug#41065: (no subject) Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).