From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server Date: Wed, 23 Nov 2022 13:44:48 +0000 Message-ID: References: <9bb290c8-f000-31d8-265d-b5441c33eb38@dfreeman.email> <4d50b820-7053-75eb-5b11-d3d36a02b013@dfreeman.email> <87v8nxsrq6.fsf@gmail.com> <87cza40xgs.fsf@dfreeman.email> <83edubrvf0.fsf@gnu.org> <87cz9v9irh.fsf@gmail.com> <83o7terf9a.fsf@gnu.org> <87k042tqze.fsf@dfreeman.email> <87fseqtpiu.fsf@dfreeman.email> <875yfm8lzf.fsf@gmail.com> <83wn82osoo.fsf@gnu.org> <871qq8xfzr.fsf@gmx.de> <87mt8uwo2q.fsf@dfreeman.email> <87zgcs6nvb.fsf@gmx.de> <87r0y3luad.fsf@dfreeman.email> <87iljf72ua.fsf@gmx.de> <87a64qykcf.fsf@gmx.de> <8735ab12pr.fsf@gmx.de> <720bcf72-e944-4978-982f-4b6fa8b31e5c@gmail.com> <83edttztfd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000072d3d05ee237af2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40668"; mail-complaints-to="usenet@ciao.gmane.io" Cc: felician.nemeth@gmail.com, danny@dfreeman.email, 58790@debbugs.gnu.org, rcopley@gmail.com, michael.albinus@gmx.de, stefankangas@gmail.com, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 23 14:44:32 2022 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 1oxq3D-000AOh-T3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Nov 2022 14:44:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxq2m-00087u-Ky; Wed, 23 Nov 2022 08:44:04 -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 1oxq2k-00087K-O8 for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 08:44:02 -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 1oxq2k-0003B4-GI for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 08:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxq2k-0005n8-3R for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 08:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Nov 2022 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58790 X-GNU-PR-Package: emacs Original-Received: via spool by 58790-submit@debbugs.gnu.org id=B58790.166921103022225 (code B ref 58790); Wed, 23 Nov 2022 13:44:02 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 23 Nov 2022 13:43:50 +0000 Original-Received: from localhost ([127.0.0.1]:54182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxq2Y-0005mO-87 for submit@debbugs.gnu.org; Wed, 23 Nov 2022 08:43:50 -0500 Original-Received: from mail-oi1-f169.google.com ([209.85.167.169]:33699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxq2V-0005m3-Tg for 58790@debbugs.gnu.org; Wed, 23 Nov 2022 08:43:48 -0500 Original-Received: by mail-oi1-f169.google.com with SMTP id c129so19086222oia.0 for <58790@debbugs.gnu.org>; Wed, 23 Nov 2022 05:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=liR1xi4DRahJ1nDSLSMvtBFylajn2d10g9eaFoJf1fk=; b=ieSlmzgyEvEcXZ8gfq+o1g6R2NnQWHeZAQj34HrXTNBtZ+EkQCcMCuOgnD85Kx10Ye /NHZio7P5k+wlWK7NayxioxgLyT+dcwvhBSCbGPZgi2hgW6z2BM1+M7RHNi5M838wrkO H6lJTR5Fq6jdhzOYVv6d8r2ydQocZ4h9QECrQc9E3/DQamLlCP1LtdFGmIDJ6XtrSARo FGGdxVDPL66rmcyEDvacvKie8o5pL3mSIvdPTwk8ur6rG7T3u9SESHRQLiIkrIBj63cz kqCmXaAJdnm/cUTb2fUfAPWBGb9feErfaTVctcu/vzZuMWy7PypgKRwxkvisd8Rpc0Gy 1eSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=liR1xi4DRahJ1nDSLSMvtBFylajn2d10g9eaFoJf1fk=; b=dZcTnzNXYNp/mIrk+fwZYbV3cBLuv1MPaCc2tkswUDpz2wyRKdLbK6NbmyaLly55Vi pdmYGVMUCBSDV3tavTObrX6GPLJWP/R2zgVW1pyuBmowJxmYmmwpVw40JXklP/4mquEK Hw7fcZemzInEqG/tbKB7POUCTrX1BDzOkbUCqVRG7omKODorksbJr+ZySMVD2iMYDzfg 6doLrhgRB1ESUAL0h4nJM+hfZuR/6rh94wxauOZyRBEMoXk4M3P6n/CEcktOG9cDACRs Lc2yat4XNtqRUH/Mm+CLGcZEiRToliI0/3c3hPb0YfijW6ocJLg74NXZf5/7o6NE1qkz nG3A== X-Gm-Message-State: ANoB5plWovF5QteItkIxU6D4m4zxvD2WepAnVA3AZ2jKtCS+6JR7lsUP g/C3wg2fLuCZQou2jGtnYFGntrNzAcomgmgkFKk= X-Google-Smtp-Source: AA0mqf64ZCUcO45jI/B6ruzMUnzTNRZ/uppholjHA6vriLQVsjvZkmc4+xQC8oDMnGNLEmBxCCagAs3bVPg+E/0bljU= X-Received: by 2002:aca:170d:0:b0:35a:7e8d:8ad6 with SMTP id j13-20020aca170d000000b0035a7e8d8ad6mr4455075oii.171.1669211022108; Wed, 23 Nov 2022 05:43:42 -0800 (PST) In-Reply-To: <83edttztfd.fsf@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:248742 Archived-At: --000000000000072d3d05ee237af2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 23, 2022 at 1:34 PM Eli Zaretskii wrote: > > From: Jo=C3=A3o T=C3=A1vora > > Date: Wed, 23 Nov 2022 12:36:37 +0000 > > Cc: Danny Freeman , Felician Nemeth < > felician.nemeth@gmail.com>, > > 58790@debbugs.gnu.org, Stefan Kangas , > > Dmitry Gutov , Eli Zaretskii , > > Michael Albinus > > > > Yes,I think I follow. To be clear I think the problem is somewhere in > > > > (defun eglot--path-to-uri (path) > > "URIfy PATH." > > (let ((truepath (file-truename path))) > > (if (url-type (url-generic-parse-url truepath)) > > ;; Path is already a URI, so forward it to the LSP server > > ;; untouched. The server should be able to handle it, since > > ;; it provided this URI to clients in the first place. > > truepath > > ...) > > > > So either url-generic-parse-url and url-type is fixed in url-parse.el, > or > > we must add some Windows-specific guards in eglot.el. Or likely > > both, since url-parse.el is not a :core ELPA package. > > > > Richard/Danny, can you perhaps come up with some patch? > > From where I stand, the solution was already proposed here: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59338#53 Right. When I wrote that, I was unaware of this second bug report. > You said you wanted to augment it with something that didn't depend on > url-parse.el, because it wasn't in Emacs < 29, but I don't think I > understand the concern, since AFAICT url-parse.el is in all versions of > Emacs since at least Emacs 23. So what am I missing? > Maybe I misunderstood, but it seemed like you were proposing that we change url-parse.el so that it isn't fooled into thinking windows path names are URLs with the drive letter as the 'url-type'. If that were the correct solution (I tend to think it is), then it would _not_ suffice to fix Eglot on Emacsen older than 29, because url-parse.el is not distributed separately as a :core ELPA package. So unless we made url-parse.el such a package, we would need a Danny's "kludgy" patch to eglot.el anyway. In any case, I suggest that a solution be based on the patch shown in that > bug#59338 discussion. > Having now read Danny's patch, I think it's good to commit. Jo=C3=A3o --000000000000072d3d05ee237af2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 23, 2022 at 1:34 PM Eli Zaretskii <eliz@gnu.org> wrote:
<= div class=3D"gmail_quote">
> From: Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com>
> Date: Wed, 23 Nov 2022 12:36:37 +0000
> Cc: Danny Freeman <danny@dfreeman.email>, Felician Nemeth <felician.nemet= h@gmail.com>,
>=C2=A0 =C2=A0 =C2=A0 =C2=A058790@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>= ,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0Dmitry Gutov <dgutov@yandex.ru>, Eli Zaretskii <eliz@gnu.org>,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0Michael Albinus <michael.albinus@gmx.de>
>
> Yes,I think I follow.=C2=A0 To be clear I think the problem is somewhe= re in
>
> (defun eglot--path-to-uri (path)
>=C2=A0 =C2=A0"URIfy PATH."
>=C2=A0 =C2=A0(let ((truepath (file-truename path)))
>=C2=A0 =C2=A0 =C2=A0(if (url-type (url-generic-parse-url truepath))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Path is already a URI, so forward = it to the LSP server
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; untouched.=C2=A0 The server should= be able to handle it, since
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; it provided this URI to clients in= the first place.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0truepath
>=C2=A0 =C2=A0 =C2=A0 =C2=A0...)
>
> So either url-generic-parse-url and url-type is fixed in url-parse.el,= or
> we must add some Windows-specific guards in eglot.el.=C2=A0 Or likely<= br> > both, since url-parse.el is not a :core ELPA package.
>
> Richard/Danny, can you perhaps come up with some patch?

>From where I stand, the solution was already proposed here:

=C2=A0 https://debbugs.gnu.org/cgi/bugreport= .cgi?bug=3D59338#53

Right. When I wrote= that, I was unaware of this second bug report.
=C2=A0
You said you wanted to augment it with something that didn't depend on<= br> url-parse.el, because it wasn't in Emacs < 29, but I don't think= I
understand the concern, since AFAICT url-parse.el is in all versions of
Emacs since at least Emacs 23.=C2=A0 So what am I missing?
=

Maybe I misunderstood, but it seemed like you were prop= osing that
we change url-parse.el so that=C2=A0 it isn't fool= ed into thinking windows path
names are URLs with the drive = letter as the 'url-type'.

If that were= the correct solution (I tend to think it is), then it would
_not= _ suffice to fix Eglot on Emacsen older than 29, because url-parse.el
<= /div>
is not distributed separately as a :core ELPA package.
=
So unless we made url-parse.el such a package, we would need= a Danny's
"kludgy" patch to eglot.el anyway.<= br>

In any case, I suggest that a solution be based on the patch shown in that<= br> bug#59338 discussion.

Having now read Danny's patch, I = think it's good to commit.

Jo=C3=A3o
=
=C2=A0
--000000000000072d3d05ee237af2--