unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Trojan Source detection/highlight in Emacs?
Date: Tue, 02 Nov 2021 10:14:01 -0400	[thread overview]
Message-ID: <jwv35oeejmq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: jwvsfwffojf.fsf-monnier+emacs@gnu.org

>> if access_level != "user{U+202E} {U+2066}// Check if admin{U+2069}
>> {U+2066}" {
>>
>> ...would be rendered by bidirectional-aware tools as:
>>
>> if access_level != "user" { // Check if admin
>>
>> This would give the reader the mistaken impression that the program is
>> comparing admin_level with the value "user".
>
> Clearly, Eli will know better, but I suspect that we may be able to
> avoid most of those issues by (conceptually) treating comment delimiters
> as bidi barriers.  Of course, that leaves open the question of what
> I mean by "bidi barrier" and of how to implement it ;-)

Tho, actually, the problem is more pronounced since bidi can also be
used within a string (as shown above already) as well as within
identifiers (tho language may opt to disallow them there).

So my suggestion above would have to be extended to treat string
delimiters as barriers, and similarly for "identifier delimiters"
(i.e. whitespace, infix operators/punctuation, ...) tho not when within
comments or strings.
And of course, the specifics are all language-dependent.
Clearly non-trivial.


        Stefan




  parent reply	other threads:[~2021-11-02 14:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 22:19 Trojan Source detection/highlight in Emacs? Skip Montanaro
2021-11-01 23:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-02 14:09   ` Eli Zaretskii
2021-11-02 14:56     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-02 15:19       ` Eli Zaretskii
2021-11-02 14:14   ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2021-11-02 14:01 ` Eli Zaretskii
2021-11-02 15:01   ` Skip Montanaro
2021-11-02 15:13     ` Eli Zaretskii
2021-11-02 15:12   ` Stefan Monnier via Users list for the GNU Emacs text editor
  -- strict thread matches above, loose matches on Subject: below --
2021-11-03  8:52 Anders Munch
2021-11-03 13:03 ` Eli Zaretskii
2021-11-03 15:17 Anders Munch
2021-11-03 17:28 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv35oeejmq.fsf-monnier+emacs@gnu.org \
    --to=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).