From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Derek Upham Newsgroups: gmane.emacs.bugs Subject: bug#2491: 23.0.90; Flymake too aggressive when responding to unusual error combination Date: Thu, 14 Jan 2016 18:48:57 -0800 Message-ID: <87io2vd0bq.fsf@priss.frightenedpiglet.com> References: <20090227041420.3646.qmail@priss.frightenedpiglet.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1452826227 25029 80.91.229.3 (15 Jan 2016 02:50:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Jan 2016 02:50:27 +0000 (UTC) Cc: 2491@debbugs.gnu.org, rfrancoise@debian.org To: Andrew Hyatt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 15 03:50:15 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aJuSs-0008JR-Lj for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Jan 2016 03:50:14 +0100 Original-Received: from localhost ([::1]:45204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJuSo-0004Ui-Jz for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jan 2016 21:50:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJuSk-0004T6-JV for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2016 21:50:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJuSg-0001Y9-BE for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2016 21:50:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJuSg-0001Y5-6u for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2016 21:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aJuSf-0006NZ-Vc for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2016 21:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Derek Upham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Jan 2016 02:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2491 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 2491-submit@debbugs.gnu.org id=B2491.145282614224442 (code B ref 2491); Fri, 15 Jan 2016 02:50:01 +0000 Original-Received: (at 2491) by debbugs.gnu.org; 15 Jan 2016 02:49:02 +0000 Original-Received: from localhost ([127.0.0.1]:49526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aJuRh-0006Lz-OE for submit@debbugs.gnu.org; Thu, 14 Jan 2016 21:49:02 -0500 Original-Received: from smtp61.avvanta.com ([206.124.128.61]:55560 helo=mail.avvanta.com) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aJuRf-0006Ll-UV for 2491@debbugs.gnu.org; Thu, 14 Jan 2016 21:49:00 -0500 Original-Received: from mail.avvanta.com (localhost.rowlf.p [127.0.0.1]) by mail.avvanta.com (Postfix) with ESMTP id 0E24A93C81; Thu, 14 Jan 2016 18:47:06 -0800 (PST) Original-Received: from priss.frightenedpiglet.com (c-98-225-51-194.hsd1.wa.comcast.net [98.225.51.194]) by mail.avvanta.com (Postfix) with ESMTP id EC71B93C40; Thu, 14 Jan 2016 18:47:05 -0800 (PST) Original-Received: from localhost ([127.0.0.1] helo=priss.frightenedpiglet.com) by priss.frightenedpiglet.com with esmtp (Exim 4.86) (envelope-from ) id 1aJuRe-0002us-1B; Thu, 14 Jan 2016 18:48:58 -0800 User-agent: mu4e 0.9.9.5; emacs 25.0.50.1 In-reply-to: X-BlargAV-Status: No viruses detected, BlargAV v1.1 on localhost.scooter.p.blarg.net 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111626 Archived-At: The situation is a flymake check for “foo.c”, where “foo.c” is perfectly fine but it #includes “bar.h” which has a syntax error. Flymake triggers a compilation. The compilation fails due to the syntax error, returning a non-zero exit status, along with the text bar.h:30: error: Invalid syntax Flymake quietly drops any error messages that refer to anything other than “foo.c”. As far as it is concerned, the above error output is empty. That means... - The error and warning counts are zero - The exit status is non-zero - The check was not interrupted The nested ‘if’ clauses in ‘flymake-post-syntax-check’ route control through: (flymake-report-fatal-status "CFGERR" (format "Configuration error has occured while running %s" command)) This code reports a fatal error and permanently turns off Flymake in the buffer. After you fix the syntax error in “bar.h”, you have to restart Flymake in “foo.c” (and any other files that depended on it). The bug is that we need to explicitly restart Flymake. The proposed solution in the bug report is to treat this case as a non-fatal situation, with a special mode line tag to indicate “there’s a deeper problem”. (It would be great if we could point the user to an error in “bar.h” line 30, but I don’t think there’s a good way to do it in the UI.) Upon reflection, I think it’s better for Flymake to keep counts of errors and warnings in “other” files (not ignore them) and use that to improve the post-syntax-check tests with another “if” clause. (I’m pretty sure this was with Erlang code, which is why no one else has encountered the bug. As I recall, GCC provides enough breadcrumbs that the #include line in the .c file will be tagged as a problem. The Erlang compiler doesn’t show that information, or didn’t back then.) Derek ahyatt@gmail.com writes: > Thanks for the bug report, and sorry it's sat so long without any > movement. Looking over this, I don't particularly understand the issue > (why would the check return a non-zero exit status if it was working > properly?) It might help if you provided a simple example. > > I've looked at the code in Emacs 25, though, and it still has the logic > you report. > > sand@blarg.net writes: > >> Background >> ---------- >> >> The Flymake library shipped with CVS HEAD (and probably earlier) has >> the following code in `flymake-post-syntax-check': >> >> (defun flymake-post-syntax-check (exit-status command) >> ;; [. . . elided . . .] >> >> (if (and (equal 0 err-count) (equal 0 warn-count)) >> (if (equal 0 exit-status) >> (flymake-report-status "" "") ; PASSED >> (if (not flymake-check-was-interrupted) >> (flymake-report-fatal-status "CFGERR" >> (format "Configuration error has occured while running %s" command)) >> (flymake-report-status nil ""))) ; "STOPPED" >> (flymake-report-status (format "%d/%d" err-count warn-count) ""))) >> >> Depending on... >> >> ...whether the flymake check generated errors or warnings, >> ...whether the flymake check had a non-zero exit status, and >> ...whether we interrupted the flymake check, >> >> we can generate any of four different statuses. One of the statuses, >> "CFGERR" is fatal, and turns off flymake for that buffer. The others >> are non-fatal. >> >> Problem >> ------- >> >> Flymake only tracks errors that refer to the specific file being >> checked. For example, given the following output for "foo.c", >> which includes file "bar.h" >> >> foo.c:20: warning: Type mismatch >> bar.h:30: error: Invalid syntax >> >> Flymake would "see" one warning and no errors. The "bar.h" error is >> dropped. Now consider the degenerate case where "bar.h" is the only >> source of errors, *and the check returns a non-zero exit status*: >> >> bar.h:30: error: Invalid syntax >> >> The error and warning counts are zero, the exit status is non-zero, >> the check was not interrupted, so we end up reporting a fatal CFGERR. >> >> Think aobut the user experience here, with the two examples shown >> above. First, Flymake checks, and reports an warning in the current >> file "foo.c". The user fixes the warning. Then Flymake reports a >> fatal error (popping up a dialog box under X) and turns itself off! >> >> Solution >> -------- >> >> That particular code branch is supposed to catch cases where the build >> system itself dies with an error, which is important to detect. But >> shutting down Flymake is too excessive a response, because of errors >> in included files. >> >> The following replacement code changes the behavior to report zero >> errors and zero warnings with the file itself, but it adds a ":CFGERR" >> flag to indicate that there was some other problem with the check. >> Flymake remains enabled for the buffer. >> >> (defun flymake-post-syntax-check (exit-status command) >> ;; [. . . elided . . .] >> >> (if (and (equal 0 err-count) (equal 0 warn-count)) >> (if (equal 0 exit-status) >> (flymake-report-status "" "") ; PASSED >> (if (not flymake-check-was-interrupted) >> (flymake-report-status "0/0" ":CFGERR") >> (flymake-report-status nil ""))) ; "STOPPED" >> (flymake-report-status (format "%d/%d" err-count warn-count) ""))) >> >> >> Derek >> >> >> >> >> In GNU Emacs 23.0.90.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) >> of 2009-02-07 on elegiac, modified by Debian >> (emacs-snapshot package, version 1:20090207-1) >> Windowing system distributor `The X.Org Foundation', version 11.0.10402000 >> configured using `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' > '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.90/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.90/site-lisp:/usr/share/emacs/site-lisp' > '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS='' -- Derek Upham sand@blarg.net