GNU bug report logs - #34093
auto-save prevents quitting emacs on read-only filesystem

Previous Next

Package: emacs;

Reported by: Leonard Lausen <leonard <at> lausen.nl>

Date: Wed, 16 Jan 2019 03:03:02 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 34093 in the body.
You can then email your comments to 34093 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#34093; Package emacs. (Wed, 16 Jan 2019 03:03:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leonard Lausen <leonard <at> lausen.nl>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jan 2019 03:03:03 GMT) Full text and rfc822 format available.

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

From: Leonard Lausen <leonard <at> lausen.nl>
To: bug-gnu-emacs <at> gnu.org
Subject: auto-save prevents quitting emacs on read-only filesystem
Date: Wed, 16 Jan 2019 03:01:28 +0000
Recently my filesystem had to be emergency remounted as read-only. I
observed that I could not kill-emacs anymore. The following showed up in
my log upon trying to quit emacs:

```
company-statistics--save: Opening output file: Read-only file system, /home/leonard/.emacs.d/.cache/company-statistics-cache.el
Error running timer ‘savehist-autosave’: (file-error "Opening output file" "Read-only file system" "/home/leonard/.emacs.d/.cache/savehist")
```

This prevented quitting emacs.

I am not sure if `company-statistics--save` prevented the shutdown, or
just warned about the read-only file system. Possibly the behavior of
`company-statistics--save` is sane and only `savehist-autosave` is at
fault. Maybe both are at fault?

The expected behavior is that emacs may warn about or ignore that it
cannot write the savehist file. Calling kill-emacs should still quit
emacs.

The company-mode bug report is at
https://github.com/company-mode/company-mode/issues/860

This is with GNU Emacs 26.1 and the following init.el
https://github.com/leezu/dotfiles/blob/master/emacs/.spacemacs.d/init.el




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34093; Package emacs. (Tue, 18 Aug 2020 17:53:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Leonard Lausen <leonard <at> lausen.nl>
Cc: 34093 <at> debbugs.gnu.org
Subject: Re: bug#34093: auto-save prevents quitting emacs on read-only
 filesystem
Date: Tue, 18 Aug 2020 17:52:24 +0000
[Message part 1 (text/plain, inline)]
tags 34093 + patch
thanks

Leonard Lausen <leonard <at> lausen.nl> writes:

> Recently my filesystem had to be emergency remounted as read-only. I
> observed that I could not kill-emacs anymore. The following showed up in
> my log upon trying to quit emacs:
>
> ```
> company-statistics--save: Opening output file: Read-only file system, /home/leonard/.emacs.d/.cache/company-statistics-cache.el
> Error running timer ‘savehist-autosave’: (file-error "Opening output file" "Read-only file system" "/home/leonard/.emacs.d/.cache/savehist")
> ```
>
> This prevented quitting emacs.
>
> I am not sure if `company-statistics--save` prevented the shutdown, or
> just warned about the read-only file system. Possibly the behavior of
> `company-statistics--save` is sane and only `savehist-autosave` is at
> fault. Maybe both are at fault?
>
> The expected behavior is that emacs may warn about or ignore that it
> cannot write the savehist file. Calling kill-emacs should still quit
> emacs.

I can reproduce this under "emacs -Q" by evaluating:

(progn (savehist-mode)
       (setq savehist-file "/usr/foo")
       (confirm-exit-emacs))

I have attached a patch which fixes this bug by showing a warning if
this file is not readable.

Best regards,
Stefan Kangas
[0001-Fix-exiting-Emacs-when-savehist-file-not-writable.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 18 Aug 2020 17:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34093; Package emacs. (Tue, 18 Aug 2020 18:21:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 34093 <at> debbugs.gnu.org, leonard <at> lausen.nl
Subject: Re: bug#34093: auto-save prevents quitting emacs on read-only
 filesystem
Date: Tue, 18 Aug 2020 21:20:13 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 18 Aug 2020 17:52:24 +0000
> Cc: 34093 <at> debbugs.gnu.org
> 
> (progn (savehist-mode)
>        (setq savehist-file "/usr/foo")
>        (confirm-exit-emacs))
> 
> I have attached a patch which fixes this bug by showing a warning if
> this file is not readable.

Thanks, but is a single warning really enough?  What if the situation
is slightly different, in that the user could somehow resolve the
problem -- should we perhaps prompt the user whether to retry or
ignore the error?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34093; Package emacs. (Tue, 18 Aug 2020 18:45:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34093 <at> debbugs.gnu.org, leonard <at> lausen.nl
Subject: Re: bug#34093: auto-save prevents quitting emacs on read-only
 filesystem
Date: Tue, 18 Aug 2020 18:44:06 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but is a single warning really enough?  What if the situation
> is slightly different, in that the user could somehow resolve the
> problem -- should we perhaps prompt the user whether to retry or
> ignore the error?

Is it worth it?  The bug will presumably trigger only under rare
circumstances such as serious misconfiguration by the user or serious
system failure ($HOME remounted as read-only sounds fairly exceptional).
And the consequence is that the user will miss out on a very minor
convenience feature.

OTOH, I'm not a regular user of savehist-mode, so I'm not sure.  Maybe
people really depend on saving their minibuffer history between
sessions...  But even then, they would be no worse off with my proposed
fix than they are now.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34093; Package emacs. (Tue, 11 May 2021 13:59:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 34093 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, leonard <at> lausen.nl
Subject: Re: bug#34093: auto-save prevents quitting emacs on read-only
 filesystem
Date: Tue, 11 May 2021 15:58:08 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Thanks, but is a single warning really enough?  What if the situation
>> is slightly different, in that the user could somehow resolve the
>> problem -- should we perhaps prompt the user whether to retry or
>> ignore the error?
>
> Is it worth it?  The bug will presumably trigger only under rare
> circumstances such as serious misconfiguration by the user or serious
> system failure ($HOME remounted as read-only sounds fairly exceptional).
> And the consequence is that the user will miss out on a very minor
> convenience feature.

I agree with Stefan that the fix should be sufficient for most usages,
so I've applied it to Emacs 28.  It would be nice if it went even
further, of course, but the patch is at the very least a step in the
right direction in itself.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 May 2021 13:59:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 34093 <at> debbugs.gnu.org and Leonard Lausen <leonard <at> lausen.nl> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 May 2021 13:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34093; Package emacs. (Wed, 12 May 2021 04:05:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34093 <at> debbugs.gnu.org, leonard <at> lausen.nl, stefan <at> marxist.se
Subject: Re: bug#34093: auto-save prevents quitting emacs on read-only
 filesystem
Date: Wed, 12 May 2021 00:04:29 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

The situation where something goes wrong with a disk, and you can't
save your files any more, can be very painful.  So let's try to be as
helpful as we can be.  We can offer to save on another disk, or over
the net.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Jun 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 321 days ago.

Previous Next


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