GNU bug report logs - #9139
24.0.50; Inappropriate warning: "File no longer exists!"

Previous Next

Package: emacs;

Reported by: Bastien <bzg <at> altern.org>

Date: Thu, 21 Jul 2011 09:30:03 UTC

Severity: minor

Found in version 24.0.50

Done: Eli Zaretskii <eliz <at> gnu.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 9139 in the body.
You can then email your comments to 9139 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Thu, 21 Jul 2011 09:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bastien <bzg <at> altern.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Jul 2011 09:30:03 GMT) Full text and rfc822 format available.

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

From: Bastien <bzg <at> altern.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Thu, 21 Jul 2011 11:29:39 +0200
Emacs sends an inappropriate warning message when trying to 
find a file that isn't on the hardrive but is the filename of 
a buffer, thus somehow "existing" in Emacs.

To reproduce the problem:

emacs -Q
C-x f ~/foo.txt
C-x b bar
C-x f ~/foo.txt

  => File no longer exists!

I suggest simply removing this warning is such a case.


In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.5)
 of 2011-07-10 on myhost
Windowing system distributor `The X.Org Foundation', version 11.0.11002000
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: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Text

-- 
 Bastien




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Thu, 21 Jul 2011 10:18:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Bastien <bzg <at> altern.org>
Cc: 9139 <at> debbugs.gnu.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Thu, 21 Jul 2011 06:17:05 -0400
> From: Bastien <bzg <at> altern.org>
> Date: Thu, 21 Jul 2011 11:29:39 +0200
> 
> Emacs sends an inappropriate warning message when trying to 
> find a file that isn't on the hardrive but is the filename of 
> a buffer, thus somehow "existing" in Emacs.
> 
> To reproduce the problem:
> 
> emacs -Q
> C-x f ~/foo.txt
> C-x b bar
> C-x f ~/foo.txt
> 
>   => File no longer exists!

Why is that inappropriate?  Emacs checks whether the file is newer
than it was when it was last visited or saved, to make sure you don't
accidentally overwrite the file with stale data.  If the file no
longer exists, this test cannot be performed, so Emacs alerts you to
that fact.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Thu, 21 Jul 2011 10:27:01 GMT) Full text and rfc822 format available.

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

From: Bastien <bzg <at> altern.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9139 <at> debbugs.gnu.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Thu, 21 Jul 2011 12:27:06 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Bastien <bzg <at> altern.org>
>> Date: Thu, 21 Jul 2011 11:29:39 +0200
>> 
>> Emacs sends an inappropriate warning message when trying to 
>> find a file that isn't on the hardrive but is the filename of 
>> a buffer, thus somehow "existing" in Emacs.
>> 
>> To reproduce the problem:
>> 
>> emacs -Q
>> C-x f ~/foo.txt
>> C-x b bar
>> C-x f ~/foo.txt
>> 
>>   => File no longer exists!
>
> Why is that inappropriate?
>
> Emacs checks whether the file is newer
> than it was when it was last visited or saved, to make sure you don't
> accidentally overwrite the file with stale data.  If the file no
> longer exists, this test cannot be performed, so Emacs alerts you to
> that fact.

I understand the need for a warning, but emacs asserts that the file 
*no longer* exists while this file never existed before.

I suggest changing the message like this:

  "File %s doesn't exist"

-- 
 Bastien




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Sun, 11 Sep 2011 03:00:07 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Bastien <bzg <at> altern.org>
Cc: 9139 <at> debbugs.gnu.org
Subject: Re: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Sun, 11 Sep 2011 04:52:29 +0200
Bastien <bzg <at> altern.org> writes:

> Emacs sends an inappropriate warning message when trying to 
> find a file that isn't on the hardrive but is the filename of 
> a buffer, thus somehow "existing" in Emacs.
>
> To reproduce the problem:
>
> emacs -Q
> C-x f ~/foo.txt
> C-x b bar
> C-x f ~/foo.txt
>
>   => File no longer exists!

Yes, it shouldn't say anything in this instance.

But how?  It's this code in files.el:

		  (cond ((not (file-exists-p filename))
			 (setq nonexistent t)
			 (message "File %s no longer exists!" filename))

Is there something stored in the buffer that's stored if the file once
has existed, but no longer exists?  Let's see...

(visited-file-modtime)
=> (-1 65535)

in foo.txt.  But is that a bug?

The doc string says:

Return the current buffer's recorded visited file modification time.
The value is a list of the form (HIGH LOW), like the time values
that `file-attributes' returns.  If the current buffer has no recorded
file modification time, this function returns 0.

So I think that perhaps is should return 0?
                         
-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 11 Sep 2011 06:05:02 GMT) Full text and rfc822 format available.

Notification sent to Bastien <bzg <at> altern.org>:
bug acknowledged by developer. (Sun, 11 Sep 2011 06:05:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: 9139-done <at> debbugs.gnu.org, bzg <at> altern.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Sun, 11 Sep 2011 02:00:10 -0400
> From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
> Date: Sun, 11 Sep 2011 04:52:29 +0200
> Cc: 9139 <at> debbugs.gnu.org
> 
> > emacs -Q
> > C-x f ~/foo.txt
> > C-x b bar
> > C-x f ~/foo.txt
> >
> >   => File no longer exists!
> 
> Yes, it shouldn't say anything in this instance.
> 
> But how?  It's this code in files.el:
> 
> 		  (cond ((not (file-exists-p filename))
> 			 (setq nonexistent t)
> 			 (message "File %s no longer exists!" filename))

The magic is in the previous line.  The code does this:

	      (or nowarn
		  (verify-visited-file-modtime buf)
		  (cond ((not (file-exists-p filename))
			 (setq nonexistent t)
			 (message "File %s no longer exists!" filename))

The problem was that verify-visited-file-modtime would return nil in
this case, where it returned t in Emacs 23.  And that's because the
internal details of verify-visited-file-modtime changed, but
insert-file-contents didn't have the corresponding change.  It does
now (revno 105721).

> (visited-file-modtime)
> => (-1 65535)
> 
> in foo.txt.  But is that a bug?

No.  -1 as the modtime exactly means that the file does not exist.  So
at most we need to update the doc string, assuming that we want to
reveal such implementation details.

Btw, WIBNI visited-file-modtime returned (-1 -1) in this case, instead
of forcing us to invoke the unsigned-to-signed converter in our heads?

> So I think that perhaps is should return 0?

Zero is for existing files that were not modified since visited.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Sun, 11 Sep 2011 15:04:02 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9139 <at> debbugs.gnu.org, bzg <at> altern.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Sun, 11 Sep 2011 16:49:40 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> (visited-file-modtime)
>> => (-1 65535)
>> 
>> in foo.txt.  But is that a bug?
>
> No.  -1 as the modtime exactly means that the file does not exist.  So
> at most we need to update the doc string, assuming that we want to
> reveal such implementation details.

I've now updated the doc string.  It seems like a non-optimal return
value for this situation (nil might make more sense), though, but
changing that might break stuff, I guess.

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Sun, 11 Sep 2011 19:03:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 9139 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Sun, 11 Sep 2011 14:57:59 -0400
Eli Zaretskii wrote:

> The problem was that verify-visited-file-modtime would return nil in
> this case, where it returned t in Emacs 23.  And that's because the
> internal details of verify-visited-file-modtime changed, but
> insert-file-contents didn't have the corresponding change.  It does
> now (revno 105721).

Sounds like you've fixed bug#7547? (Thanks.)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9139; Package emacs. (Sun, 11 Sep 2011 20:11:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9139 <at> debbugs.gnu.org
Subject: Re: bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
Date: Sun, 11 Sep 2011 23:05:50 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: eliz <at> gnu.org
> Date: Sun, 11 Sep 2011 14:57:59 -0400
> 
> Eli Zaretskii wrote:
> 
> > The problem was that verify-visited-file-modtime would return nil in
> > this case, where it returned t in Emacs 23.  And that's because the
> > internal details of verify-visited-file-modtime changed, but
> > insert-file-contents didn't have the corresponding change.  It does
> > now (revno 105721).
> 
> Sounds like you've fixed bug#7547? (Thanks.)

I guess so.  You're welcome.




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

This bug report was last modified 12 years and 202 days ago.

Previous Next


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