[Top][All Lists]

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

file-exists-p can return t when file doesn't exist

From: Leo
Subject: file-exists-p can return t when file doesn't exist
Date: Sun, 01 Aug 2010 12:41:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4)


I find that file-exists-p can return t on a non-existing file and
because of this causing errors in subsequent operations. My current
workaround is to reset tramp-cache-data.

It is clear a bug on tramp's part. I am using the version of tramp on
the emacs-23 branch of emacs upstream. Any idea for a fix?

Sorry I haven't found a recipe to reproduce it yet but basically it
happens often enough when using magit on a remote git repo. The cause
seems to be tramp caches the info whether a file exists on remote
machine but in the process of git operations some file disappears and
tramp continues to use the cache. The culprit is this snippet (NB it
doesn't involve magit)

(when (file-exists-p ".git/MERGE_MSG")
      (insert-file-contents ".git/MERGE_MSG"))

as in this

(defun magit-pop-to-log-edit (operation)
  (let ((dir default-directory)
        (buf (get-buffer-create magit-log-edit-buffer-name)))
    (setq magit-pre-log-edit-window-configuration
    (pop-to-buffer buf)
    (when (file-exists-p ".git/MERGE_MSG")
      (insert-file-contents ".git/MERGE_MSG"))
    (setq default-directory dir)
    (message "Type C-c C-c to %s (C-c C-k to cancel)." operation)))

Best wishes,

reply via email to

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