unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	57804@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
Date: Fri, 16 Sep 2022 00:53:37 +0200	[thread overview]
Message-ID: <CAG7Bparp9tyNBAiqqO_tWsHHq3jcnaF577+1-AFHCsAaWEj4Ug@mail.gmail.com> (raw)
In-Reply-To: <b24128855b2c2fdadfaa@heytings.org>

[-- Attachment #1: Type: text/plain, Size: 3949 bytes --]

> > I don't know why, this is a hypothetical, but fairly realistic
> > situation, right?
>
> Discussing hypothetical issues leads nowhere, according to my experience.
> Let's focus on actual issues.

I have shown you a simple way how your supposed can break things. Yes,
it's not an everyday occurence, but if I could think of one easily,
this or something else to this effect will be used in reality. As a
reminder, Emacs self-advertises itself as "advanced, extensible"
editor. You are making some extensions illegal, because maybe
something somewhere might become slow. You are sacrificing
functionality in the name of performance.

> It is for example possible to parse the buffer outside of
> fontification-functions

You are ignoring that this is not only about fontification. It can
happen anywhere, because I may need full access to the buffer at any
time.

> and to use the result of that parsing inside
> fontification-functions.

Parsing is done lazily. You are saying I need to prepare parsing
results everywhere in the whole buffer at once (which easily can be 10
MB - I have seen logs 250 MB in size, but not ones with lines longer
than ~50 K characters), because I don't know in advance where
fontification (or whatever else) might be needed.

> Yet another method would be to use a simpler fontification method in
> buffers with too long lines.  Yet another method would be to turn
> font locking off in buffers with too long lines.

I don't want to lose fontification in a 10 MB buffer because one line
somewhere there is over 10000 characters.

> Yet another method would be to truncate too long lines.

Eh? And corrupt the log? Otherwise, even if it is invisible it stays
in the buffer.

> I also cannot understand why it is necessary, in log files in
> which all lines are independent

No they are not. Typically Java exceptions are logged like this:

    2022-09-15 23:11:00.014 ERROR [some.Class] (some-thread) bla-bla-bla
    exception.Class: bla-bla-bla
          at some.Class

and so on. Exceptions are not the only multiline entries.

I have already complained about this often-seen-here "I also cannot
understand", which implies "therefore no-one will ever need", but you
said it was bad attitude from me.

> > Will I be able to lift locked narrowing restrictions without knowing the
> > tag?
>
> This is akin to a security mechanism, there is no reason to make it
> possible to turn it off "too easily".

Security against what, for fuck's sake? By trying to prevent "making
it too easily", you are preventing this at all in general case. And
what are the gains?

Paul

On Fri, 16 Sept 2022 at 00:16, Gregory Heytings <gregory@heytings.org>
wrote:

>
> >
> > I don't know why, this is a hypothetical, but fairly realistic
> > situation, right?
> >
>
> Discussing hypothetical issues leads nowhere, according to my experience.
> Let's focus on actual issues.
>
> >
> > Now, let's say function `logview-do-bla-bla-bla' cannot work with
> > narrowed buffer (half of functions in Logview cannot).
> >
>
> You said I'm not allowed to tell you that your code could do things
> differently, but that doesn't mean it isn't true.  It is for example
> possible to parse the buffer outside of fontification-functions and to use
> the result of that parsing inside fontification-functions.  Yet another
> method would be to use a simpler fontification method in buffers with too
> long lines.  Yet another method would be to turn font locking off in
> buffers with too long lines.  Yet another method would be to truncate too
> long lines.  I also cannot understand why it is necessary, in log files in
> which all lines are independent, to move beyond the beginning and end of a
> line to decide how it must be fontified.
>
> >
> > Will I be able to lift locked narrowing restrictions without knowing the
> > tag?
> >
>
> This is akin to a security mechanism, there is no reason to make it
> possible to turn it off "too easily".
>

[-- Attachment #2: Type: text/html, Size: 4797 bytes --]

  reply	other threads:[~2022-09-15 22:53 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:05 bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely Paul Pogonyshev
2022-09-14 16:00 ` dick
2022-09-14 16:06   ` Paul Pogonyshev
2022-09-14 16:14 ` dick
2022-09-14 17:52   ` Lars Ingebrigtsen
2022-09-14 18:18     ` Eli Zaretskii
2022-09-14 16:41 ` Lars Ingebrigtsen
2022-09-14 16:57   ` Paul Pogonyshev
2022-09-14 17:25     ` Lars Ingebrigtsen
2022-09-14 17:30       ` Paul Pogonyshev
2022-09-14 17:43       ` Eli Zaretskii
2022-09-14 17:45         ` Lars Ingebrigtsen
2022-09-14 17:49           ` Eli Zaretskii
2022-09-15  2:17             ` Ihor Radchenko
2022-09-14 17:34     ` Gregory Heytings
2022-09-15 14:47       ` Paul Pogonyshev
2022-09-15 15:10         ` Gregory Heytings
2022-09-15 15:37           ` Paul Pogonyshev
2022-09-15 16:08             ` Gregory Heytings
2022-09-15 16:19               ` Paul Pogonyshev
2022-09-15 16:44                 ` Gregory Heytings
2022-09-15 18:49                   ` Paul Pogonyshev
2022-09-15 19:16                     ` Eli Zaretskii
2022-09-15 19:36                       ` Paul Pogonyshev
2022-09-15 19:45                         ` Eli Zaretskii
2022-09-15 20:18                         ` Gregory Heytings
2022-09-15 20:22                           ` Lars Ingebrigtsen
2022-09-15 20:40                           ` Paul Pogonyshev
2022-09-15 20:44                             ` Gregory Heytings
2022-09-15 21:17                               ` Paul Pogonyshev
2022-09-15 21:32                                 ` Gregory Heytings
2022-09-15 21:49                                   ` Paul Pogonyshev
2022-09-15 22:16                                     ` Gregory Heytings
2022-09-15 22:53                                       ` Paul Pogonyshev [this message]
2022-09-15 23:13                                         ` Gregory Heytings
2022-09-16  6:40                                         ` Eli Zaretskii
2022-09-16 10:08                                           ` Paul Pogonyshev
2022-09-16 10:44                                             ` Eli Zaretskii
2022-09-16  6:31                             ` Eli Zaretskii
     [not found]                               ` <1260fd38-d4b3-5ca1-5b15-78f59c0255b6@yandex.ru>
     [not found]                                 ` <83o7t9k8fr.fsf@gnu.org>
     [not found]                                   ` <CAG7Bpaow570a8Qrq6VxU+=MNF55UmnCMFFXT2Eg=vQUTgrxeoQ@mail.gmail.com>
     [not found]                                     ` <34e17bf2a6bdd269fba7@heytings.org>
     [not found]                                       ` <CAG7BpapFE0HEwi8iUoStz9EyAwH-QdZ_CxOUNtdUeKDmzCrZaQ@mail.gmail.com>
     [not found]                                         ` <338f50d421074805735f@heytings.org>
     [not found]                                           ` <831qpnngeg.fsf@gnu.org>
     [not found]                                             ` <338f50d421b672315145@heytings.org>
2022-11-28 18:32                                               ` Eli Zaretskii
2022-09-16  1:17                           ` Ihor Radchenko
2022-09-16  5:35                           ` Eli Zaretskii
2022-09-15 19:44                     ` Gregory Heytings
2022-09-15 20:07                       ` Paul Pogonyshev
2022-09-15 20:26                         ` Gregory Heytings
2022-09-16  5:37                           ` Eli Zaretskii
2022-09-15 22:20                       ` dick
2022-09-15 22:38                         ` Gregory Heytings
2022-09-16  6:19                         ` Eli Zaretskii
2022-09-16  7:44                         ` Gerd Möllmann
2022-09-14 17:02 ` Eli Zaretskii
2022-09-14 17:25   ` Paul Pogonyshev
2022-09-14 17:32     ` Eli Zaretskii
2022-09-14 17:38   ` Lars Ingebrigtsen
2022-09-14 17:44     ` Eli Zaretskii
2022-09-14 17:46       ` Lars Ingebrigtsen
2022-09-14 17:51         ` Eli Zaretskii
2022-09-15  5:20     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-15  6:27       ` 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=CAG7Bparp9tyNBAiqqO_tWsHHq3jcnaF577+1-AFHCsAaWEj4Ug@mail.gmail.com \
    --to=pogonyshev@gmail.com \
    --cc=57804@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).