[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13743: 24.2.93; Segmentation fault when trying to [s]teal a file ope

From: Eli Zaretskii
Subject: bug#13743: 24.2.93; Segmentation fault when trying to [s]teal a file opened elsewhere
Date: Mon, 25 Feb 2013 20:56:19 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Mon, 25 Feb 2013 13:29:57 -0500
> turn on overwrite-mode and replace the char at point with itself:
> sure enough the buffer is marked as modified.

Since you know how things work internally in this case, I'm surprised
that you bring this example.  It is not analogous to what happens in
the case in point.  In the case in point, we didn't change anything at
all, we just walked the interval tree and wound up discovering that no
changes are needed.  But the call to modify_region was issued before
we made that discovery -- and that's the problem.

By contrast, in overwrite-mode we actually make the change without
trying to avoid it.

> Along the same lines, try (setq t t) and watch how it complains that
> we're trying to modify a read-only object, ...

Feel free to fix this blunder.

> > You can repeat the last 2 steps forever, the buffer always becomes
> > modified.  I don't see how this could be anything but a bug.  Not a
> > catastrophe, I agree, but a bug nonetheless.
> add-text-property is a mutation operation, like setq.  Whether or not it
> returns data about the "old state" doesn't make it less of
> a side-effecting operation, in my eyes.

If add-text-property was a black box, I might consider agreeing with
you.  But since it isn't, and its algorithm is glaringly clear, I
don't.  The algorithm clearly tries to avoid mutation when possible,
it just didn't go far enough.

> So, no I do not consider it to be a bug at all.

Not even considering the fact that it causes redisplay do redundant
work?  If so, we will have to agree to disagree.

> Try (add-text-properties 2 10 '(foo nil)) for another corner case: the
> `foo' property was already nil (by default), and yet add-text-properties
> claims that setting it to nil is a modification.

I didn't say that what I fixed was the last bug.

> >> And I don't think it's an important one here, since (as Dmitry points
> >> out) the likely most common case (of having `start' be right at the
> >> beginning of an interval object) didn't work anyway
> > It does work now.  More importantly, it fixed the original crash.
> I suspect it only works around the crash by optimizing away the call
> to modify_region in the particular case you're testing.

So you think I should install the followup I showed earlier?

> >> and furthermore most calls to add-text-properties are likely to be
> >> protected by inhibit-modification-hooks.
> > I don't think inhibit-modification-hooks stops the file-locking prompt
> > from being shown, does it?
> Well, I meant not just inhibit-modification-hooks but
> with-silent-modifications (or a comparable set of let-bindings and
> unwind-protect), which does prevent the prompt.

Not with mmm-mode, it doesn't.  If you repeat the original recipe for
the crash, putting a breakpoint in filelock.c where it calls
ask-user-about-lock, and type 'p' to the first prompt, you will get a
second prompt, triggered by jit-lock, which does use
with-silent-modifications, AFAICS.  I didn't try to figure out why
this happens.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]