From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61668: Bug in flymake-proc with fix Date: Tue, 21 Feb 2023 14:35:08 +0200 Message-ID: <83lekrtcw3.fsf@gnu.org> References: <096AC334-D7CF-41A2-BFFA-FE3BE3A13C05@me.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6810"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61668@debbugs.gnu.org To: Camden Narzt , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 21 13:36:40 2023 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 1pURst-0001dZ-Bt for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Feb 2023 13:36:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pURsd-00071s-E5; Tue, 21 Feb 2023 07:36:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pURsb-0006zV-1G for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 07:36:21 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pURsI-00054M-Mu for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 07:36:13 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pURsI-0002Ii-IV for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2023 07:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Feb 2023 12:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61668 X-GNU-PR-Package: emacs Original-Received: via spool by 61668-submit@debbugs.gnu.org id=B61668.16769829108706 (code B ref 61668); Tue, 21 Feb 2023 12:36:02 +0000 Original-Received: (at 61668) by debbugs.gnu.org; 21 Feb 2023 12:35:10 +0000 Original-Received: from localhost ([127.0.0.1]:54847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pURrR-0002GK-Up for submit@debbugs.gnu.org; Tue, 21 Feb 2023 07:35:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pURrP-0002Fi-43 for 61668@debbugs.gnu.org; Tue, 21 Feb 2023 07:35:08 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pURrI-0004Yc-Ri; Tue, 21 Feb 2023 07:35:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=lHHgsJIao16N+UsXZQJP7Rtjo5IUnniTqnTsNDzt36g=; b=AQ8GWvW+M/chyr7Ntmmw 0pxachSmePaN9DsDmzl0VgVyYm+l4t1fpT5VJAycghNlMzJRiHH10eTM9gluMg7kk+lTH+ERniyWa BBjAOJKGr/qV6dzFRxbdukBZ0GFD1lgINhtdas++U5qqRnsXq0Ydh2Xj2MMEMRnfzgvTj99yRDUaC DXxweQfTydZpS63rla+/FUFzyaRAYO8KbEsJ9GnTGkv5mvXqEuDlTaloub7wg2XcFKpnVDBkV2t7M dcRiNOESEIiYAgPf3FbO4/W2hxRxhyMFv02+zJg1N5TIGtDQVBu2ltASCuk2zCMw5eknO9ViWjTNl VMf3/xI3xiubBQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pURrI-00038X-Ai; Tue, 21 Feb 2023 07:35:00 -0500 In-Reply-To: <096AC334-D7CF-41A2-BFFA-FE3BE3A13C05@me.com> (bug-gnu-emacs@gnu.org) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256257 Archived-At: Adding João. > Date: Mon, 20 Feb 2023 11:23:02 -0700 > From: Camden Narzt via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I’m sorry if this is not the correct place to report a flymake-proc bug, but since flymake is included in the emacs git repo I figured it might be ok. > > I’m currently seeing incorrect behaviour from the `flymake-proc--delete-temp-directory` function. The path is parsed and then reassembled incorrectly as the following backtrace extract demonstrates: > > flymake-proc--safe-delete-directory("/private/var/folders/p7/03_g5t611499lmjqhwc5tljr0000gn/T/000gn/T/Users/camdennarzt/Developer/Java/getargv.java/src/main/java/cam/narzt/getargv") > flymake-proc--delete-temp-directory("/private/var/folders/p7/03_g5t611499lmjqhwc5tljr0000gn/T/Users/camdennarzt/Developer/Java/getargv.java/src/main/java/cam/narzt/getargv/“) > > As you can see the `000gn/T/` segment of the path gets duplicated when `flymake-proc--safe-delete-directory` gets called. > > This is because in `flymake-proc--delete-temp-directory` when the `suffix` variable is declared it is assumed that `(directory-file-name temporary-file-directory)` is a prefix of the `dir-name` argument, however `(directory-file-name temporary-file-directory)` doesn’t seem to resolve symlinks in the path whereas `dir-name` seems to have symlinks already resolved, so they don’t necessarily match. On my system the difference is: > > (directory-file-name temporary-file-directory) → "/var/folders/p7/03_g5t611499lmjqhwc5tljr0000gn/T” > dir-name → "/private/var/folders/p7/03_g5t611499lmjqhwc5tljr0000gn/T/Users/camdennarzt/Developer/Java/getargv.java/src/main/java/cam/narzt/getargv/“ > > Note the "/private” prefix on the `dir-name` path. That difference in length causes the suffix to be incorrectly determined and then causes a bunch of errors while any subsequent function call tries to work with a path with the `000gn/T/` segment duplicated which obviously doesn’t exist in the fs. > > Changing the suffix variable to be computed as follows fixes the bug: > > (substring dir-name (1+ (length (file-truename (expand-file-name (directory-file-name temp-dir)))))) > > > If this can be fixed that’s great, if there’s somewhere else I should report this I’d love to know. > > Cheers, > > Camden Narzt > > >