> From: Eli Zaretskii [mailto:e...@gnu.org] > Sent: Tuesday, January 03, 2012 2:36 PM > >> From: "Katz, Dan" <dpk...@arc.baincapital.com> >> Date: Tue, 3 Jan 2012 18:20:10 +0000 >> >>> does Emacs succeed in deleting it, or do you get the same "permission >>> denied" error again? >> >> If I just call delete-file as you suggest, it succeeds and deletes the file. > > Which probably means that some process holds that file open when Emacs > originally tries to delete it. Maybe the ftp process?
As a crude attempt to test the idea that some process is temporarily holding the file open, I modified ange-ftp-del-tmp-name to add a 4 second sleep before deleting the temporary file. When I did this, I was sometimes able to get into the /ftp:anonym...@ftp.gnu.org:/gnu directory. And sometimes not (though this time it's a different problem): ====================================================================================================================== Debugger entered--Lisp error: (ftp-error #("FTP Error: DIR failed: 0.05498.13200 PORT command successful. Consider using PASV." 23 82 (front-sticky (field inhibit-line-move-field-capture) rear-nonsticky t field output inhibit-line-move-field-capture t))) signal(ftp-error (#("FTP Error: DIR failed: 0.05498.13200 PORT command successful. Consider using PASV." 23 82 (front-sticky (field inhibit-line-move-field-capture) rear-nonsticky t field output inhibit-line-move-field-capture t)))) (cond ((and completion (zerop (length localname)) (memq operation (quote (file-exists-p file-directory-p)))) t) ((and completion (zerop (length localname)) (memq operation (quote (expand-file-name file-name-as-directory)))) filename) (t (signal (car err) (cdr err)))) (condition-case err (let ((sf (symbol-function foreign))) (when (and (listp sf) (eq (car sf) (quote autoload))) (let ((default-directory (tramp-compat-temporary-file-directory))) (load (cadr sf) (quote noerror) (quote nomessage)))) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop (length localname)) (memq operation (quote (file-exists-p file-directory-p)))) t) ((and completion (zerop (length localname)) (memq operation (quote (expand-file-name file-name-as-directory)))) filename) (t (signal (car err) (cdr err)))))) (if foreign (condition-case err (let ((sf (symbol-function foreign))) (when (and (listp sf) (eq (car sf) (quote autoload))) (let ((default-directory (tramp-compat-temporary-file-directory))) (load (cadr sf) (quote noerror) (quote nomessage)))) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop (length localname)) (memq operation (quote ...))) t) ((and completion (zerop (length localname)) (memq operation (quote ...))) filename) (t (signal (car err) (cdr err)))))) (tramp-run-real-handler operation args)) (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v))) (if foreign (condition-case err (let ((sf (symbol-function foreign))) (when (and (listp sf) (eq (car sf) (quote autoload))) (let ((default-directory ...)) (load (cadr sf) (quote noerror) (quote nomessage)))) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop ...) (memq operation ...)) t) ((and completion (zerop ...) (memq operation ...)) filename) (t (signal (car err) (cdr err)))))) (tramp-run-real-handler operation args))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let ((sf (symbol-function foreign))) (when (and (listp sf) (eq (car sf) (quote autoload))) (let ((default-directory ...)) (load (cadr sf) (quote noerror) (quote nomessage)))) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop ...) (memq operation ...)) t) ((and completion (zerop ...) (memq operation ...)) filename) (t (signal (car err) (cdr err)))))) (tramp-run-real-handler operation args))) (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let ((sf (symbol-function foreign))) (when (and (listp sf) (eq ... ...)) (let (...) (load ... ... ...))) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append ... args))) (signal (car err) (cdr err))) (error (cond ((and completion ... ...) t) ((and completion ... ...) filename) (t (signal ... ...))))) (tramp-run-real-handler operation args)))) (progn (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let ((sf ...)) (when (and ... ...) (let ... ...)) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" ...)) (signal (car err) (cdr err))) (error (cond (... t) (... filename) (t ...)))) (tramp-run-real-handler operation args))))) (unwind-protect (progn (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let (...) (when ... ...) (apply foreign operation args)) ((debug quit) (let ... ...) (signal ... ...)) (error (cond ... ... ...))) (tramp-run-real-handler operation args))))) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let* ((filename (tramp-replace-environment-variables (apply ... operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let ... ... ...) (... ... ...) (error ...)) (tramp-run-real-handler operation args))))) (set-match-data save-match-data-internal (quote evaporate)))) (save-match-data (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let ((sf ...)) (when (and ... ...) (let ... ...)) (apply foreign operation args)) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" ...)) (signal (car err) (cdr err))) (error (cond (... t) (... filename) (t ...)))) (tramp-run-real-handler operation args))))) (if tramp-mode (save-match-data (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (with-parsed-tramp-file-name filename nil (if foreign (condition-case err (let (...) (when ... ...) (apply foreign operation args)) ((debug quit) (let ... ...) (signal ... ...)) (error (cond ... ... ...))) (tramp-run-real-handler operation args))))) (tramp-run-real-handler operation args)) tramp-file-name-handler(insert-directory "/ftp:anonym...@ftp.gnu.org:/gnu/" "-al" nil t) insert-directory("/ftp:anonym...@ftp.gnu.org:/gnu/" "-al" nil t) dired-insert-directory("/ftp:anonym...@ftp.gnu.org:/gnu/" "-al" nil nil t) dired-readin-insert() dired-readin() dired-internal-noselect("/ftp:anonym...@ftp.gnu.org:/gnu/" nil) dired-noselect("/ftp:anonym...@ftp.gnu.org:/gnu") run-hook-with-args-until-success(dired-noselect "/ftp:anonym...@ftp.gnu.org:/gnu") find-file-noselect("/ftp:anonym...@ftp.gnu.org:/gnu" nil nil t) find-file("/ftp:anonym...@ftp.gnu.org:/gnu" t) call-interactively(find-file) ido-file-internal(raise-frame) ido-find-file() call-interactively(ido-find-file nil nil) ====================================================================================================================== Adding a sleep time is obviously no solution to the problem, but the change in behavior would seem to suggest that we're on the right track with a timing issue. Of course, whether that's due to the ftp process holding on, or a virus scanner (as Andy Moreton suggested) or something else is not really clear yet. Dan ---------------------------------------------------------------- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Bain Capital, LLC Boston, MA USA +1 (617) 516 2000