GNU bug report logs - #66660
[PATCH] Fix dns-mode-syntax-table

Previous Next

Package: emacs;

Reported by: Lassi Kortela <lassi <at> lassi.io>

Date: Sat, 21 Oct 2023 06:18:01 UTC

Severity: normal

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66660 in the body.
You can then email your comments to 66660 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 06:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lassi Kortela <lassi <at> lassi.io>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Oct 2023 06:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lassi Kortela <lassi <at> lassi.io>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix dns-mode-syntax-table
Date: Fri, 20 Oct 2023 19:21:11 +0300
[Message part 1 (text/plain, inline)]
Attached is a simple fix to the syntax highlighting of dns-mode.

The patch highlights double-quoted strings as specified in RFC 1035.	
[dns-mode-syntax-table.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 09:17:01 GMT) Full text and rfc822 format available.

Message #8 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lassi Kortela <lassi <at> lassi.io>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 02:15:58 -0700
Lassi Kortela <lassi <at> lassi.io> writes:

> Attached is a simple fix to the syntax highlighting of dns-mode.
>
> The patch highlights double-quoted strings as specified in RFC 1035.	

Thanks for the patch.

Could you provide an example of something which is incorrectly
highlighted, briefly explain what is wrong before your patch, and what
your patch does?  Thanks again.

> --- dns-mode.el.orig	2023-10-20 19:12:43.000000000 +0300
> +++ dns-mode.el	2023-10-20 19:13:01.000000000 +0300
> @@ -137,6 +137,8 @@
>    (let ((table (make-syntax-table)))
>      (modify-syntax-entry ?\; "<   " table)
>      (modify-syntax-entry ?\n ">   " table)
> +    (modify-syntax-entry ?\" "\"" table)
> +    (modify-syntax-entry ?\\ "\\" table)
>      table)
>    "Syntax table in use in DNS master file buffers.")
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 09:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lassi Kortela <lassi <at> lassi.io>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 02:41:43 -0700
Lassi Kortela <lassi <at> lassi.io> writes:

> On the following two lines, the text in double quotes was not
> highlighted.
>
> @ IN TXT "v=spf1 include:simplelists.com -all"
>
> srfi IN TXT "v=spf1 include:simplelists.com -all"
>
> On the following line, the part "k=rsa was not highlighted, and the
> rest of the line ;p=MIGf[...]QAB" starting at the semicolon was
> incorrectly highlighted as a comment instead of a string literal.
>
> selector1._domainkey.srfi IN TXT "k=rsa;p=MIGf[...]QAB"
>
> The patch causes the parts in double quotes to be highlighted as string
> literals. Since the part starting at the semicolon is inside a string,
> it is no longer incorrectly highlighted as a comment.
>
> Motion commands such as forward-sexp are likewise fixed.

Thanks, this seems to have already been fixed on master:

    commit c586d984f279aa61de4f5dfc4f6df660188dd0f6
    Author: Stefan Kangas <stefankangas <at> gmail.com>
    Date:   Tue Sep 5 23:06:21 2023 +0200

        Make `dns-mode` fontify quoted values correctly

        * lisp/textmodes/dns-mode.el (dns-mode-syntax-table): Fontify
        quoted values correctly.  (Bug#62214)
        Suggested by Trent W. Buck <trentbuck <at> gmail.com>.

However, the patch on master only has:

+    (modify-syntax-entry ?\" "\""   table)

But your patch has this:

+    (modify-syntax-entry ?\" "\"" table)
+    (modify-syntax-entry ?\\ "\\" table)

Do we need the second line there, too?  If yes, why?

Perhaps this fix should be cherry-picked to emacs-29, as well.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 10:00:03 GMT) Full text and rfc822 format available.

Message #14 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lassi Kortela <lassi <at> lassi.io>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 02:58:58 -0700
Lassi Kortela <lassi <at> lassi.io> writes:

> Quoting from <https://datatracker.ietf.org/doc/html/rfc1035>:
>
> <character-string> is expressed in one or two ways: as a contiguous set
> of characters without interior spaces, or as a string beginning with a "
> and ending with a ".  Inside a " delimited string any character can
> occur, except for a " itself, which must be quoted using \ (back slash).

Thanks, so I would like to install this patch.

Could you please send the patch as an attachment formatted by this
command:

    git format-patch -1

That would save me time when installing the patch, and its easier to
make sure I don't make any mistakes with attributing the change to you.

Please also add the bug number of this bug in the commit message, like
so: Bug#66660.

Thanks in advance.




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sat, 21 Oct 2023 10:32:02 GMT) Full text and rfc822 format available.

Notification sent to Lassi Kortela <lassi <at> lassi.io>:
bug acknowledged by developer. (Sat, 21 Oct 2023 10:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 66660-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lassi Kortela <lassi <at> lassi.io>, 66660-done <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 03:30:53 -0700
Version: 30.1

Lassi Kortela <lassi <at> lassi.io> writes:

>> Could you please send the patch as an attachment formatted by this
>> command:
>>
>>      git format-patch -1
>>
>> That would save me time when installing the patch, and its easier to
>> make sure I don't make any mistakes with attributing the change to you.
>>
>> Please also add the bug number of this bug in the commit message, like
>> so: Bug#66660.
>
> Attached. Thank you.

Thanks, installed on master.

I will backport it to emacs-29 as well, unless anyone objects.

[1: e6f05e189db]: 2023-10-21 12:28:34 +0200
  Recognize backslash in `dns-mode` quoted values
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e6f05e189db73a0f0b29f987381ffef61a409232




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 13:48:02 GMT) Full text and rfc822 format available.

Message #22 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Lassi Kortela <lassi <at> lassi.io>
To: Stefan Kangas <stefankangas <at> gmail.com>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 12:31:40 +0300
> Could you provide an example of something which is incorrectly
> highlighted, briefly explain what is wrong before your patch, and what
> your patch does?  Thanks again.

Sure. Here is the DNS zone for the domain schemers.org:

https://raw.githubusercontent.com/schemeorg/schemeorg/master/dns/schemers.org.zone

On the following two lines, the text in double quotes was not
highlighted.

@ IN TXT "v=spf1 include:simplelists.com -all"

srfi IN TXT "v=spf1 include:simplelists.com -all"

On the following line, the part "k=rsa was not highlighted, and the
rest of the line ;p=MIGf[...]QAB" starting at the semicolon was
incorrectly highlighted as a comment instead of a string literal.

selector1._domainkey.srfi IN TXT "k=rsa;p=MIGf[...]QAB"

The patch causes the parts in double quotes to be highlighted as string 
literals. Since the part starting at the semicolon is inside a string, 
it is no longer incorrectly highlighted as a comment.

Motion commands such as forward-sexp are likewise fixed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 13:48:02 GMT) Full text and rfc822 format available.

Message #25 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Lassi Kortela <lassi <at> lassi.io>
To: Stefan Kangas <stefankangas <at> gmail.com>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 12:49:18 +0300
> Thanks, this seems to have already been fixed on master:

Indeed. My apologies. I did not realize that.

> However, the patch on master only has:
> 
> +    (modify-syntax-entry ?\" "\""   table)
> 
> But your patch has this:
> 
> +    (modify-syntax-entry ?\" "\"" table)
> +    (modify-syntax-entry ?\\ "\\" table)
> 
> Do we need the second line there, too?  If yes, why?

Quoting from <https://datatracker.ietf.org/doc/html/rfc1035>:

<character-string> is expressed in one or two ways: as a contiguous set
of characters without interior spaces, or as a string beginning with a "
and ending with a ".  Inside a " delimited string any character can
occur, except for a " itself, which must be quoted using \ (back slash).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66660; Package emacs. (Sat, 21 Oct 2023 13:48:03 GMT) Full text and rfc822 format available.

Message #28 received at 66660 <at> debbugs.gnu.org (full text, mbox):

From: Lassi Kortela <lassi <at> lassi.io>
To: Stefan Kangas <stefankangas <at> gmail.com>, 66660 <at> debbugs.gnu.org
Subject: Re: bug#66660: [PATCH] Fix dns-mode-syntax-table
Date: Sat, 21 Oct 2023 13:15:42 +0300
[Message part 1 (text/plain, inline)]
> Could you please send the patch as an attachment formatted by this
> command:
> 
>      git format-patch -1
> 
> That would save me time when installing the patch, and its easier to
> make sure I don't make any mistakes with attributing the change to you.
> 
> Please also add the bug number of this bug in the commit message, like
> so: Bug#66660.

Attached. Thank you.
[0001-Recognize-backslash-in-dns-mode-quoted-values.patch (text/plain, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Nov 2023 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.