GNU bug report logs - #11274
23.1; auto-save invoked in read-only directories

Previous Next

Package: emacs;

Reported by: <danh <at> mail.archive.org>

Date: Wed, 18 Apr 2012 22:32:01 UTC

Severity: minor

Merged with 18907

Found in versions 23.1, 25.0.50

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 11274 in the body.
You can then email your comments to 11274 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#11274; Package emacs. (Wed, 18 Apr 2012 22:32:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to <danh <at> mail.archive.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 18 Apr 2012 22:32:01 GMT) Full text and rfc822 format available.

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

From: <danh <at> mail.archive.org>
To: bug-gnu-emacs <at> gnu.org
Cc: danh <at> archive.org
Subject: 23.1; auto-save invoked in read-only directories
Date: Wed, 18 Apr 2012 14:03:37 -0700
When i edit a file in a directory to which i do not have
write-permission (such as /etc), after i type a line or
two of text, or type a few characters and then move around
in the buffer, emacs will suddenly freeze and just print
a message in the mini-buffer that my text could not be auto-saved.

The message stays up for several seconds before it
yields control of the terminal back to me.

This is extremely inconvenient, and the only way i can
prevent this from happening is to frequently save the file.

I do not want to turn auto-save off, or to mark any buffers
as to not be auto-saved, or to change the location of the
auto-saves (unless it can be done once and forever, only
apply to files in write-protected directories and no others,
and not require a listing of either the files or directories
to which it is to be applied).

The desired behavior is that emacs recognize that a directory
is write-protected, and if an attempt to write to that directory
fails, that it fail silently.  (It would be quite OK to have
this governed by the behavior of a variable set in my .emacs file.)

I am not the only person who has reported this problem to
newsgroups, but i wasn't aware of the possibility of filing
a bug from within emacs until Michael Heerdegen told me
about it.

(Note that emacs does not crash, and never has for me.  But
the freezing happens to me, colleagues of mine, and people
i've never heard of on the newsgroups.)

dan  (danh <at> archive.org)


In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-11-23 on yellow, modified by Debian
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 2 4 0 3 ; 0 c ESC x C-f r e p o r t - e 
m TAB RET

Recent messages:
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50git-core.el (source)...done
Loading /etc/emacs/site-start.d/50js2-mode.el (source)...done
Loading /etc/emacs/site-start.d/50mmm-mode.el (source)...done
Loading /etc/emacs/site-start.d/50php-elisp.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /home/danh/elisp/readonly.el (source)...done
Loading /home/danh/.abbrev_defs...done
For information about GNU Emacs and the GNU system, type C-h C-a.
call-interactively: End of buffer




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11274; Package emacs. (Thu, 19 Apr 2012 06:45:02 GMT) Full text and rfc822 format available.

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

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#11274: 23.1; auto-save invoked in read-only directories
Date: Thu, 19 Apr 2012 00:44:33 -0600
On 4/18/12 3:03 PM, danh <at> mail.archive.org wrote:
> When i edit a file in a directory to which i do not have
> write-permission (such as /etc), after i type a line or
> two of text, or type a few characters and then move around
> in the buffer, emacs will suddenly freeze and just print
> a message in the mini-buffer that my text could not be auto-saved.
>
> The message stays up for several seconds before it
> yields control of the terminal back to me.
>
> This is extremely inconvenient, and the only way i can
> prevent this from happening is to frequently save the file.

These statements seem contradictory to me:

> I do not want to turn auto-save off, or to mark any buffers
                                       ^^^^^^^^^^^^^^^^^^^^^^
> as to not be auto-saved, or to change the location of the
  ^^^^^^^^^^^^^^^^^^^^^^^
> auto-saves (unless it can be done once and forever, only
> apply to files in write-protected directories and no others,
> and not require a listing of either the files or directories
> to which it is to be applied).
>
> The desired behavior is that emacs recognize that a directory
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> is write-protected, and if an attempt to write to that directory
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> fails, that it fail silently.  (It would be quite OK to have
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> this governed by the behavior of a variable set in my .emacs file.)

(add-hook 'find-file-hook
	  (lambda () (when (file-writable-p
			    (file-name-directory buffer-file-name))
		       (auto-save-mode 0))))

(add-hook 'find-file-not-found-functions
	  (lambda () (when (file-writable-p
			    (file-name-directory buffer-file-name))
		       (auto-save-mode 0))
		     ;; don't short-circuit run-hook-with-args-until-success:
		     nil))

> I am not the only person who has reported this problem to
> newsgroups, but i wasn't aware of the possibility of filing
> a bug from within emacs until Michael Heerdegen told me
> about it.
>
> (Note that emacs does not crash, and never has for me.  But
> the freezing happens to me, colleagues of mine, and people
> i've never heard of on the newsgroups.)
>
> dan  (danh <at> archive.org)

-- 
Kevin Rodgers
Denver, Colorado, USA





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11274; Package emacs. (Fri, 20 Apr 2012 01:05:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 11274 <at> debbugs.gnu.org
Subject: Re: bug#11274: 23.1; auto-save invoked in read-only directories
Date: Fri, 20 Apr 2012 03:06:04 +0200
Hello Kevin,

> On 4/18/12 3:03 PM, danh <at> mail.archive.org wrote:
> > When i edit a file in a directory to which i do not have
> > write-permission (such as /etc), after i type a line or
> > two of text, or type a few characters and then move around
> > in the buffer, emacs will suddenly freeze and just print
> > a message in the mini-buffer that my text could not be auto-saved.
> >
> > The message stays up for several seconds before it
> > yields control of the terminal back to me.
> >
> > This is extremely inconvenient, and the only way i can
> > prevent this from happening is to frequently save the file.
>
> These statements seem contradictory to me:
>
> > I do not want to turn auto-save off, or to mark any buffers
>                                        ^^^^^^^^^^^^^^^^^^^^^^
> > as to not be auto-saved, or to change the location of the
>   ^^^^^^^^^^^^^^^^^^^^^^^
> > auto-saves (unless it can be done once and forever, only
> > apply to files in write-protected directories and no others,
> > and not require a listing of either the files or directories
> > to which it is to be applied).
> >
> > The desired behavior is that emacs recognize that a directory
>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > is write-protected, and if an attempt to write to that directory
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > fails, that it fail silently.  (It would be quite OK to have
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > this governed by the behavior of a variable set in my .emacs file.)

He means that he doesn't want to have to intervene in any form.  He
wants that Emacs turns off auto saving for the file when it's not
possible to auto-save.

> (add-hook 'find-file-hook
> 	  (lambda () (when (file-writable-p
> 			    (file-name-directory buffer-file-name))
> 		       (auto-save-mode 0))))
>
> (add-hook 'find-file-not-found-functions
> 	  (lambda () (when (file-writable-p
> 			    (file-name-directory buffer-file-name))
> 		       (auto-save-mode 0))
> 		     ;; don't short-circuit run-hook-with-args-until-success:
> 		     nil))

Yes, something like that works no doubt (I think you mean
(not (file-writable-p ...)) ).

In addition, there should be a warning for the user.

But something like that should not have to be done in the user's
configuration.  The current behavior of Emacs makes no sense at all.  It
continues to try to autosave, fails every time, beeps and beeps and
shows messages.  This is not only very annoying, it does not make any
sense at all - it has no benefit for the user.

So, can we add something like the above code to Emacs?


Michael.





Forcibly Merged 11274 18907. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Tue, 28 Jun 2016 02:58:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11274; Package emacs. (Fri, 28 May 2021 02:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 18907 <at> debbugs.gnu.org, 11274 <at> debbugs.gnu.org,
 Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Subject: Re: bug#18907: 25.0.50; long pause when auto-save fails
Date: Fri, 28 May 2021 04:29:38 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> He means that he doesn't want to have to intervene in any form.  He
> wants that Emacs turns off auto saving for the file when it's not
> possible to auto-save.

I think that this has basically been implemented in the years since this
was reported.

These days, Emacs will warn by popping up the *Warnings* buffer:

Error (auto-save): Auto-saving foo: Opening output file: Permission denied, /etc/#foo# Disable showing Disable logging

And you can disable these messages by clicking on the links.

So I'm closing this bug report.

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




bug closed, send any further explanations to 18907 <at> debbugs.gnu.org and Leo Liu <sdl.web <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 28 May 2021 02:30:03 GMT) Full text and rfc822 format available.

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

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

Previous Next


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