From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.bugs Subject: bug#41065: Result of byte-compilation can be nil even if the compiled file contains no errors Date: Mon, 4 May 2020 00:21:02 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000165cbe05a4c5d5c9" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="128384"; mail-complaints-to="usenet@ciao.gmane.io" To: 41065@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 04 00:22:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVMzy-000XGp-Mg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 May 2020 00:22:10 +0200 Original-Received: from localhost ([::1]:49550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVMzx-0005LN-BM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 May 2020 18:22:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVMzq-0005L4-V2 for bug-gnu-emacs@gnu.org; Sun, 03 May 2020 18:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVMzq-0000Nq-MS for bug-gnu-emacs@gnu.org; Sun, 03 May 2020 18:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jVMzq-0003j1-JI for bug-gnu-emacs@gnu.org; Sun, 03 May 2020 18:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Pogonyshev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 May 2020 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41065 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158854447914266 (code B ref -1); Sun, 03 May 2020 22:22:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 May 2020 22:21:19 +0000 Original-Received: from localhost ([127.0.0.1]:58316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVMz9-0003i2-3D for submit@debbugs.gnu.org; Sun, 03 May 2020 18:21:19 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVMz7-0003ht-AI for submit@debbugs.gnu.org; Sun, 03 May 2020 18:21:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVMz7-0005J4-5I for bug-gnu-emacs@gnu.org; Sun, 03 May 2020 18:21:17 -0400 Original-Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVMz6-0008IW-7h for bug-gnu-emacs@gnu.org; Sun, 03 May 2020 18:21:16 -0400 Original-Received: by mail-wr1-x444.google.com with SMTP id g13so18667414wrb.8 for ; Sun, 03 May 2020 15:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=KXrlye5fy0ZndfRCfzOT/NfdjK0735PP2M/zHYgGHnU=; b=EOK2QlkxAGhKvKl6nGuZLftzXGX69n6eZMnhzOrmkV3mkCnTnGcgDQieK2ugzhRy4R rgkTzTdyB9sG4WXnf0ptamZXMNbT2rxgpDCaUJphUyrRtfObo+klpreno/3hhEtR0yD/ rjl34S1SNlzWTbAoJmrarpdN3OO9Tk0JR7y1rKtk5DWpaNbWZgM2dgeCJgZEt6wT6Dae cGYpSZupMbxtOJDvroJCGxvw/q/aVRl5EbXj7mq1rUTyG2Q0G2m8HlshGXy2sCYiQy74 wGmcjCO/9LsUeQKM2Y3ZDTUfjbn2kl3GdJwpF2+JzzXMtz2bQsQg3sq3FGMSsXN+nUJ1 sqvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=KXrlye5fy0ZndfRCfzOT/NfdjK0735PP2M/zHYgGHnU=; b=h2WVVfC+Gb3OKJHXqIsawAYKTyw3g3kcuo2rseexT5vcZH9SuepAHQWFyV2MHAgXmn 3Q9zuJJyGEfoVJaXawXNazen3capecCEjAGegh3YK7RN6bwsiNU8ieRHunUDhKSgjEnW iksaYR4/C07dv4x5MW5iF7X6ccWnnld6yfdO0HoC8L10VqZQ3VZXQrs+Ry0rEvDb9gEo Hs0jBB19fkzni884NStrBByAIqh+b+jyZVCa7Ym0Vsy+gqcYyCjub+vATXa95V7fEWUN BzNxLWwnor+k/wgE9J8yT1yJQAVJewXeLpSVpmajxei+yR3lLPOmkjH0LzkRauwyhqAZ /+/g== X-Gm-Message-State: AGi0PuaMugWH48kPgSG5c1HPMTaWeH7CCaI6kHQJJtk4Se1Lla809EdJ h9V5cEhPupiAF+o+6TayXdgduktX++y80tMCY8/zEqk= X-Google-Smtp-Source: APiQypKPW3HMViKRsPvTu2izNJHUMAqy1JUnTI1pO9HapqK6xlHpIiGlwc3+5utjDU27UTW3rl25V4QVa0lIt3Mtrr4= X-Received: by 2002:adf:b256:: with SMTP id y22mr15471396wra.355.1588544474077; Sun, 03 May 2020 15:21:14 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=pogonyshev@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179633 Archived-At: --000000000000165cbe05a4c5d5c9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=98trigger-a-warning-here-2=E2=80=99 is not known to be defin= ed. 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 --000000000000165cbe05a4c5d5c9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
To reproduce, save this as file `main.el':
=C2=A0 =C2=A0 (eval-when-compile
=C2=A0 =C2=A0 =C2=A0 (let ((default-di= rectory (expand-file-name "/tmp/myprivatelib/")))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (make-directory default-directory t)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (with-temp-file "thelib.el"
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (insert "(defun im-a-library-function ()\n"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 " =C2=A0(t= rigger-a-warning-here-1))\n"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "(provide 'thelib\n")) =C2=A0; <-= intentionally erroneous syntax
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (byte-compil= e-file "thelib.el")))

=C2=A0 =C2=A0 (defun blabla ()
= =C2=A0 =C2=A0 =C2=A0 (trigger-a-warning-here-2))

and execute:
=C2=A0 =C2=A0 $ emacs --batch --eval "(print (byte-compile-file \&quo= t;main.el\"))"

Result is:

=C2=A0 =C2=A0 In toplevel= form:
=C2=A0 =C2=A0 thelib.el:3:1: Error: End of file during parsing
=C2=A0 =C2=A0 In end of data:
=C2=A0 =C2=A0 ~/test/nested-compilati= on/main.el:12:1: Warning: the function
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =E2= =80=98trigger-a-warning-here-2=E2=80=99 is not known to be defined.

= =C2=A0 =C2=A0 nil

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

A sm= aller problem is that the path to `main.el' is written fully,
becaus= e it is apparently found from `/tmp/myprivatelib', which
further cor= roborates my guess that the two byte-compilation
processes are improperl= y lumped together.

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

I em= ailed this to to `emacs-devel' quite a while ago:

=C2=A0 =C2=A0 = https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg00227.html<= /a>

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

Paul
--000000000000165cbe05a4c5d5c9--