unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38265: 26.3; lock file is too easy to steal
@ 2019-11-19  8:35 Allen Li
  2019-11-20 22:28 ` Juri Linkov
  2021-08-11 12:40 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Allen Li @ 2019-11-19  8:35 UTC (permalink / raw)
  To: 38265

The default ask-user-about-lock is too easy to miss.

For example, if one were typing "asparagus", they would likely steal the
lock without even realizing that it happened (the "a" triggers the
prompt on buffer modification and the "s" steals the lock).

It would be nice to have the prompt be harder to hit accidentally, such
as making all of the keys uppercase or having to type them out like
yes/no (but the latter might be too heavyweight).  Or the prompt should
have a short timeout before allowing the user to respond (like how
yes-or-no-p does when you provide an invalid response).

In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10)
 of 2019-08-29 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12005000
System Description:	Arch Linux





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#38265: 26.3; lock file is too easy to steal
  2019-11-19  8:35 bug#38265: 26.3; lock file is too easy to steal Allen Li
@ 2019-11-20 22:28 ` Juri Linkov
       [not found]   ` <804kyw35tp.fsf@felesatra.moe>
  2021-08-11 12:40 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-11-20 22:28 UTC (permalink / raw)
  To: Allen Li; +Cc: 38265

> The default ask-user-about-lock is too easy to miss.
>
> For example, if one were typing "asparagus", they would likely steal the
> lock without even realizing that it happened (the "a" triggers the
> prompt on buffer modification and the "s" steals the lock).
>
> It would be nice to have the prompt be harder to hit accidentally, such
> as making all of the keys uppercase or having to type them out like
> yes/no (but the latter might be too heavyweight).  Or the prompt should
> have a short timeout before allowing the user to respond (like how
> yes-or-no-p does when you provide an invalid response).

On the request in https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00517.html
recently ‘(discard-input)’ was removed from ‘read-char-from-minibuffer’.
Should it be put back?

ask-user-about-supersession-threat uses read-char-from-minibuffer, so if
it contained ‘(discard-input)’ it could benefit from discarding such
inadvertent input as "s".

But what about the case of keyboard macros like in the link above?
What if the user recorded a keyboard macro to input that "s" intentionally?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#38265: 26.3; lock file is too easy to steal
       [not found]   ` <804kyw35tp.fsf@felesatra.moe>
@ 2019-12-16  0:04     ` Juri Linkov
  2019-12-26 19:22       ` Allen Li
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-12-16  0:04 UTC (permalink / raw)
  To: Allen Li; +Cc: 38265

>>> The default ask-user-about-lock is too easy to miss.
>>>
>>> For example, if one were typing "asparagus", they would likely steal the
>>> lock without even realizing that it happened (the "a" triggers the
>>> prompt on buffer modification and the "s" steals the lock).
>>>
>>> It would be nice to have the prompt be harder to hit accidentally, such
>>> as making all of the keys uppercase or having to type them out like
>>> yes/no (but the latter might be too heavyweight).  Or the prompt should
>>> have a short timeout before allowing the user to respond (like how
>>> yes-or-no-p does when you provide an invalid response).
>>
>> On the request in https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00517.html
>> recently ‘(discard-input)’ was removed from ‘read-char-from-minibuffer’.
>> Should it be put back?
>>
>> ask-user-about-supersession-threat uses read-char-from-minibuffer, so if
>> it contained ‘(discard-input)’ it could benefit from discarding such
>> inadvertent input as "s".
>>
>> But what about the case of keyboard macros like in the link above?
>> What if the user recorded a keyboard macro to input that "s" intentionally?
>
> We could check executing-kbd-macro and disable "interactive safety
> features".  That seems like a valid use case of executing-kbd-macro.

Yes, executing-kbd-macro could help.  Have you tried it?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#38265: 26.3; lock file is too easy to steal
  2019-12-16  0:04     ` Juri Linkov
@ 2019-12-26 19:22       ` Allen Li
  0 siblings, 0 replies; 5+ messages in thread
From: Allen Li @ 2019-12-26 19:22 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 38265

Juri Linkov <juri@linkov.net> writes:

>>>> The default ask-user-about-lock is too easy to miss.
>>>>
>>>> For example, if one were typing "asparagus", they would likely steal the
>>>> lock without even realizing that it happened (the "a" triggers the
>>>> prompt on buffer modification and the "s" steals the lock).
>>>>
>>>> It would be nice to have the prompt be harder to hit accidentally, such
>>>> as making all of the keys uppercase or having to type them out like
>>>> yes/no (but the latter might be too heavyweight).  Or the prompt should
>>>> have a short timeout before allowing the user to respond (like how
>>>> yes-or-no-p does when you provide an invalid response).
>>>
>>> On the request in https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00517.html
>>> recently ‘(discard-input)’ was removed from ‘read-char-from-minibuffer’.
>>> Should it be put back?
>>>
>>> ask-user-about-supersession-threat uses read-char-from-minibuffer, so if
>>> it contained ‘(discard-input)’ it could benefit from discarding such
>>> inadvertent input as "s".
>>>
>>> But what about the case of keyboard macros like in the link above?
>>> What if the user recorded a keyboard macro to input that "s" intentionally?
>>
>> We could check executing-kbd-macro and disable "interactive safety
>> features".  That seems like a valid use case of executing-kbd-macro.
>
> Yes, executing-kbd-macro could help.  Have you tried it?

Tried how?  I have not tried to patch the (discard-input) change to
check executing-kbd-macro, nor tried whether the (discard-input) change
addresses the concern in the original bug.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#38265: 26.3; lock file is too easy to steal
  2019-11-19  8:35 bug#38265: 26.3; lock file is too easy to steal Allen Li
  2019-11-20 22:28 ` Juri Linkov
@ 2021-08-11 12:40 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-11 12:40 UTC (permalink / raw)
  To: Allen Li; +Cc: 38265

Allen Li <darkfeline@felesatra.moe> writes:

> The default ask-user-about-lock is too easy to miss.
>
> For example, if one were typing "asparagus", they would likely steal the
> lock without even realizing that it happened (the "a" triggers the
> prompt on buffer modification and the "s" steals the lock).
>
> It would be nice to have the prompt be harder to hit accidentally, such
> as making all of the keys uppercase or having to type them out like
> yes/no (but the latter might be too heavyweight).  Or the prompt should
> have a short timeout before allowing the user to respond (like how
> yes-or-no-p does when you provide an invalid response).

I think making the lock prompt more extensive would be pretty
annoying -- we only use yes-or-no-p (and related) when doing something
destructive or dangerous, and stealing the lock isn't that dangerous.

So I think the current level of prompting is fine, and if you want more
prompting, then it should be easy enough to redefine/advice
ask-user-about-lock to be harder to get past, and I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-11 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  8:35 bug#38265: 26.3; lock file is too easy to steal Allen Li
2019-11-20 22:28 ` Juri Linkov
     [not found]   ` <804kyw35tp.fsf@felesatra.moe>
2019-12-16  0:04     ` Juri Linkov
2019-12-26 19:22       ` Allen Li
2021-08-11 12:40 ` Lars Ingebrigtsen

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