From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ship Mints Newsgroups: gmane.emacs.bugs Subject: bug#72701: eglot crash when project-files-relative-names t Date: Fri, 23 Aug 2024 10:56:47 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ae630f06205afc7b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29855"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72701@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 23 16:59:40 2024 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 1shVlL-0007XB-O5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Aug 2024 16:59:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shVl1-0002Z1-Nz; Fri, 23 Aug 2024 10:59:20 -0400 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 1shVky-0002YX-LU for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 10:59:18 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shVkx-0004Dy-M1 for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 10:59:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=mj3GHdpDUJLaNjqtFBx05HX4w567AABwNkQcevaxl18=; b=ZzSpBTkXPzpZs0/yT4gZMfdVakJQeBUXlLLA4eut89UiVyfV4tGSsCSClos5Kpys697NDfPR22l1SwhUDfc5T/iznBzN4ilKyTC/ETRSAGT389ou3pQEGTNPa5pvzb4tfX++zLyjh/gs2Afm94eFkdc3Zh5/55qFqcBKXxnH913NrIu1+aueBGVVH2C5ulSfvLTSZ0zGGZEAUw/ISUnK9bzc6puCUYRzXXtQmD/l9PeiT/ppGF/0WavXzUGUWFZ5U4qt74/bLaeyqLNyoNiLlcuHf8IltwbDKp0X4KcgE4REnLy0G72hrO28R6QxQuclLlsHBW4UMTAcdhJRBYuNbQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1shVli-0002kL-Oq for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2024 11:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2024 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72701 X-GNU-PR-Package: emacs Original-Received: via spool by 72701-submit@debbugs.gnu.org id=B72701.172442514710428 (code B ref 72701); Fri, 23 Aug 2024 15:00:02 +0000 Original-Received: (at 72701) by debbugs.gnu.org; 23 Aug 2024 14:59:07 +0000 Original-Received: from localhost ([127.0.0.1]:39973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shVkk-0002hz-VQ for submit@debbugs.gnu.org; Fri, 23 Aug 2024 10:59:06 -0400 Original-Received: from mail-vk1-f179.google.com ([209.85.221.179]:58418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shVka-0002hG-4M for 72701@debbugs.gnu.org; Fri, 23 Aug 2024 10:59:01 -0400 Original-Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-4fd136aac40so443867e0c.0 for <72701@debbugs.gnu.org>; Fri, 23 Aug 2024 07:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724425019; x=1725029819; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mj3GHdpDUJLaNjqtFBx05HX4w567AABwNkQcevaxl18=; b=WKavM6t2KXxUPcoZNK8Ev0Gu9a0qb/2iuRuHYZZYLXtuaGUtVJnUqViEayInwqRhoJ mkcoYv65sIqrlHEogSaex1hBtyXy0rnxyp6PpW4wbILgnT1+fhstBpl5IhSj8gqY0oBa 8hRmK4GmBpdXQDFNAeynA72YnLBdfm0XVSd8RMRwsJZSwLGEm9c6ZgdfKRj8ryMJylxw pHNJMO44GGTcxtM0pnfE9NpIkU3BTCui4ywUycUwfVSKgdfDYYewj63tT0DdRD2iYj98 g/A0SY7j+uhoBbbpVVrTgyw8ns+bsxlzc5leAJ0zJiqKZjNESDzA1aTXfGp2BuPvqbXP iOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724425019; x=1725029819; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mj3GHdpDUJLaNjqtFBx05HX4w567AABwNkQcevaxl18=; b=bZE1R4URTyTK0Vstg3e3FW85XsgVSfMtw8kNOQPG9UsHGZ0umBkE/3NsBkZ+3xPFcG DsF8lyBYBSDlRrd8RNRrcAChfYEeZcZ9Dz23YJVfHaf7RbzEW6c4as+4ud1VpL8sThqO W2qtV4KpzucEcujOllHO6uX85rkwKaIfigD1L/yeB2Rof5lRVvCOZ1DtqJDjROWN5hBD oL9dvTEgWERmr5W8ZnfgC9FkfXWc1iq3kge5wucWSIB16s2bWs8Tf2b+eZ+pHpzsYTIW 931jFia6XYequ+S0GfFJWkqFpwmu5ixrJdo9ITMOg0hUEd0028zam4aDVyQOEEGGmKOa UIJA== X-Gm-Message-State: AOJu0YzL8TbBhDW6F9tcg9Bu2KYz5aBEWq28eNs9ub2oqHi5RZb9kwn7 RVMuC8Touy0h10XHKBm4BIkPU6KsrGfRoykDaj4cztI0rs2OZV4mVp9iIeddDqeEWigu9Be2J/O pvqv63Htcn4BbfdIoS4VzHedPgvw= X-Google-Smtp-Source: AGHT+IGvKf86xz96tGMA3VBVSp5IxiVV8IFZ3J4JAY1jnSfUKtbz4TN50UcR+PNCEGOq42/QawK77HWxlaFVvqWaRjQ= X-Received: by 2002:a05:6122:1695:b0:4f6:aa3e:aa4c with SMTP id 71dfb90a1353d-4fd1a515ab7mr3175783e0c.3.1724425018694; Fri, 23 Aug 2024 07:56:58 -0700 (PDT) In-Reply-To: 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:290596 Archived-At: --000000000000ae630f06205afc7b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Glad I set project-files-relative-names to t and have been testing. This side-effect in Eglot is sure to bite other people who are teased by the NEWS of this new option, despite not being a defcustom. If it is not intended to be set (yet? ever?), perhaps update the docstring to indicate this. I do tend to agree with Joao that the API to project-files probably could have an optional additional argument vs. a global, especially if the intention is merely to influence a specific call-site's expected results. WRT to Eglot using relative as default, in this context it is looking for directory components and relative names might need to be adorned at least with "./" so that file-name-directory doesn't fail. Perhaps project-files-relative-names could be set to a symbol such as 'retain-relative-directory-component. On Thu, Aug 22, 2024 at 7:22=E2=80=AFPM Dmitry Gutov wro= te: > Hi! > > On 18/08/2024 18:43, Ship Mints wrote: > > project-files-relative-names was introduced a few months ago, so it's n= o > > surprise that there are some side effects when set. > > > > This affects the handler for workspace/didChangeWatchedFiles. The resul= t > > is that dirs-to-watch... > > > > (dirs-to-watch > > (delete-dups (mapcar #'file-name-directory > > (project-files > > (eglot--project server)))))) > > > > ...is nil when project-files-relative-names is t, due to > > file-name-directory failing to parse the directories it was expecting. > > This results in file-readable-p failing with a nil dir: > > You're not really supposed to customize it as an end user (or at least > not yet) - the caller code either sets it to t to indicate support for > relative names, or not. > > > (watch-dir (dir) > > (when-let ((probe > > (and (file-readable-p dir) > > > > One solution which I've tested is simply the defensive: > > > > (project-files-relative-names nil) ; add this > > (dirs-to-watch > > (delete-dups (mapcar #'file-name-directory > > (project-files > > (eglot--project server)))))) > > ...that said, someday the default value of this var will be flipped, and > some changes like that might be needed. > > The relative version is a bit faster, though, so maybe Eglot could > switch to relative names too. If it makes sense. > --000000000000ae630f06205afc7b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Glad I set project-files-relative-names to t and have been testing. This= side-effect in Eglot is sure to bite other people who are teased by the NE= WS of this new option, despite not being a defcustom.

If it is not intended to be set (y= et? ever?), perhaps update the docstring to indicate this. I do tend to agr= ee with Joao that the API to project-files probably could have an optional = additional argument vs. a global, especially if the intention is merely to = influence a specific call-site's expected results.

WRT to Eglot using relative as de= fault, in this context it is looking for directory components and relative = names might need to be adorned at least with "./" so that file-na= me-directory doesn't fail. Perhaps project-files-relative-names could b= e set to a symbol such as 'retain-relative-directory-component.

On= Thu, Aug 22, 2024 at 7:22=E2=80=AFPM Dmitry Gutov <dmitry@gutov.dev> wrote:
Hi!

On 18/08/2024 18:43, Ship Mints wrote:
> project-files-relative-names was introduced a few months=C2=A0ago, so = it's no
> surprise that there are some side effects when set.
>
> This affects the handler for=C2=A0workspace/didChangeWatchedFiles. The= result
> is that dirs-to-watch...
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(dirs-to-watch
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-dups (mapcar #'fi= le-name-directory
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(project-files
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (eglot--project server))))= ))
>
> ...is nil when=C2=A0project-files-relative-names is t, due to
> file-name-directory failing to parse the directories it was expecting.=
> This results in file-readable-p failing with a nil dir:

You're not really supposed to customize it as an end user (or at least =
not yet) - the caller code either sets it to t to indicate support for
relative names, or not.

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(watch-dir (dir)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when-let ((probe
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(and (file-readable-p dir)
>
> One solution which I've tested is simply the defensive:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(project-files-relative-names = nil) ; add this
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(dirs-to-watch
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-dups (mapcar #'fi= le-name-directory
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(project-files
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (eglot--project server))))= ))

...that said, someday the default value of this var will be flipped, and some changes like that might be needed.

The relative version is a bit faster, though, so maybe Eglot could
switch to relative names too. If it makes sense.
--000000000000ae630f06205afc7b--