unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bug in Ange-FTP with renaming files
@ 2003-07-06 14:30 Kai Großjohann
  2003-07-06 14:48 ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2003-07-06 14:30 UTC (permalink / raw
  Cc: Marco Parrone

Marco has reported a Tramp bug, and I've now found out that this is
really an Ange-FTP bug: it happens even when Tramp is disabled.  Here
is Marco's description how to make it happen:

mkdir /tmp/foo-kai
echo blabla > /tmp/kais-file
emacs -q -no-site-file -nw
C-x d /ftp:marco@localhost:/tmp
[I insert the password]
I move the point on kais-file.
R /ftp:marco@localhost:/tmp/foo-kai
I move the point on foo-kai.
RET
The point is on kais-file.
R /ftp:marco@localhost:/tmp

Ok, there is the error.
Move `/ftp:marco@localhost:/tmp/foo-kai/kais-file' to `/ftp:marco@localhost:/tmp/kais-file' failed:
(ftp-error FTP Error: DIR failed: 550 /tmp/kais-file: Not a directory.)

It is important to move a file from a directory to its subdirectory,
and then back again.  Otherwise the bug does not happen.

It is really strange.  Actually, the *ftp* buffer shows that the
rename command has completed successfully; the bug happens after
this.  I'm guessing it's the dired update that causes the problem,
but I don't know how it comes about.

I shall try to investigate further, but I thought it would be good to
let you know -- more eyes find more bugs...
-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-06 14:30 Bug in Ange-FTP with renaming files Kai Großjohann
@ 2003-07-06 14:48 ` Kai Großjohann
  2003-07-06 14:56   ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2003-07-06 14:48 UTC (permalink / raw


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> I shall try to investigate further, but I thought it would be good to
> let you know -- more eyes find more bugs...

Here is something fishy I found: after the last `R' command in dired,
dired-rename-file calls dired-rename-subdir, but the args specified
are not directories (see the second line in the following;
/tmp/foo-kai/kais-file was the old name, /tmp/kais-file is the new
name, and both are regular files):

  dired-fun-in-all-buffers("/ftp:kai@localhost:/tmp/foo-kai/kais-file/" nil dired-rename-subdir-1 "/ftp:kai@localhost:/tmp/foo-kai/kais-file/" "/ftp:kai@localhost:/tmp/kais-file/")
  dired-rename-subdir("/ftp:kai@localhost:/tmp/foo-kai/kais-file" "/ftp:kai@localhost:/tmp/kais-file")
  dired-rename-file("/ftp:kai@localhost:/tmp/foo-kai/kais-file" "/ftp:kai@localhost:/tmp/kais-file" nil)
  funcall(dired-rename-file "/ftp:kai@localhost:/tmp/foo-kai/kais-file" "/ftp:kai@localhost:/tmp/kais-file" nil)
  (progn (funcall file-creator from to dired-overwrite-confirmed) (if overwrite (dired-remove-file to)) (setq success-count (1+ success-count)) (message "%s: %d of %d" operation success-count total) (dired-add-file to actual-marker-char))
  (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) (if overwrite ...) (setq success-count ...) (message "%s: %d of %d" operation success-count total) (dired-add-file to actual-marker-char)) (file-error (progn ... ...)))
  (let* ((overwrite ...) (dired-overwrite-confirmed ...) (actual-marker-char ...)) (condition-case err (progn ... ... ... ... ...) (file-error ...)))
  (if (not to) (setq skipped (cons ... skipped)) (let* (... ... ...) (condition-case err ... ...)))
  (lambda (from) (setq to (funcall name-constructor from)) (if (equal to from) (progn ... ...)) (if (not to) (setq skipped ...) (let* ... ...)))("/ftp:kai@localhost:/tmp/foo-kai/kais-file")
  mapcar((lambda (from) (setq to (funcall name-constructor from)) (if (equal to from) (progn ... ...)) (if (not to) (setq skipped ...) (let* ... ...))) ("/ftp:kai@localhost:/tmp/foo-kai/kais-file"))
  (let (to overwrite-query overwrite-backup-query) (mapcar (function ...) fn-list))
  (let (failures skipped (success-count 0) (total ...)) (let (to overwrite-query overwrite-backup-query) (mapcar ... fn-list)) (cond (failures ...) (skipped ...) (t ...)))
  dired-create-files(dired-rename-file "Move" ("/ftp:kai@localhost:/tmp/foo-kai/kais-file") #[(from) "\302\303\b!	\"\207" [from target expand-file-name file-name-nondirectory] 3] t)
  dired-do-create-files(move dired-rename-file "Move" nil t "Rename")
  dired-do-rename(nil)
  call-interactively(dired-do-rename)

-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-06 14:48 ` Kai Großjohann
@ 2003-07-06 14:56   ` Kai Großjohann
  2003-07-06 15:10     ` Kai Großjohann
  2003-07-07  3:39     ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-07-06 14:56 UTC (permalink / raw


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> kai.grossjohann@gmx.net (Kai Großjohann) writes:
>
>> I shall try to investigate further, but I thought it would be good to
>> let you know -- more eyes find more bugs...
>
> Here is something fishy I found: after the last `R' command in dired,
> dired-rename-file calls dired-rename-subdir, but the args specified
> are not directories

Right.  This always happens:

(defun dired-rename-file (file newname ok-if-already-exists)
  (dired-handle-overwrite newname)
  (rename-file file newname ok-if-already-exists) ; error is caught in -create-files
  ;; Silently rename the visited file of any buffer visiting this file.
  (and (get-file-buffer file)
       (with-current-buffer (get-file-buffer file)
	 (set-visited-file-name newname nil t)))
  (dired-remove-file file)
  ;; See if it's an inserted subdir, and rename that, too.
  (dired-rename-subdir file newname))

Shouldn't dired-rename-subdir be conditioned on either file or newname
being a directory?  Or perhaps both?  Or shouldn't dired-rename-subdir
take care to do the right thing with non-directories?

I'm getting confused now.
-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-06 14:56   ` Kai Großjohann
@ 2003-07-06 15:10     ` Kai Großjohann
  2003-07-06 16:00       ` Kai Großjohann
  2003-07-07  3:39     ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2003-07-06 15:10 UTC (permalink / raw


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> Shouldn't dired-rename-subdir be conditioned on either file or newname
> being a directory?  Or perhaps both?  Or shouldn't dired-rename-subdir
> take care to do the right thing with non-directories?

I now tried this.  I enabled the following patch.

Now it is barfing in dired-add-entry :-/

I'm getting lost in a maze of twisty litte funcalls, all similar.

--- dired-aux.el.~1.110.~	Sat Mar 22 19:23:45 2003
+++ dired-aux.el	Sun Jul  6 17:02:01 2003
@@ -1020,6 +1020,7 @@
 ;;;###autoload
 (defun dired-rename-file (file newname ok-if-already-exists)
   (dired-handle-overwrite newname)
+  (let ((is-dir (file-directory-p file)))
   (rename-file file newname ok-if-already-exists) ; error is caught in -create-files
   ;; Silently rename the visited file of any buffer visiting this file.
   (and (get-file-buffer file)
@@ -1027,7 +1028,8 @@
 	 (set-visited-file-name newname nil t)))
   (dired-remove-file file)
   ;; See if it's an inserted subdir, and rename that, too.
-  (dired-rename-subdir file newname))
+  (when is-dir
+  (dired-rename-subdir file newname))))
 
 (defun dired-rename-subdir (from-dir to-dir)
   (setq from-dir (file-name-as-directory from-dir)


-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-06 15:10     ` Kai Großjohann
@ 2003-07-06 16:00       ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-07-06 16:00 UTC (permalink / raw


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> I now tried this.  I enabled the following patch.
> Now it is barfing in dired-add-entry :-/

Along the way, I also found that 

    (insert-directory "/ftp:kai@localhost:/tmp/kais-file" "-ld")

barfs whereas

    (insert-directory "/tmp/kais-file" "-ld")

inserts a nice line.  (/tmp/kais-file is a regular file.)

I have no idea whether this is related to the original bug I was
talking about or not.

Ange-FTP does really complicated things.  For instance,
ange-ftp-send-cmd frobs the command mightily, depending on what it is.
If the command is `dir', it issues `cd' first, and then `dir'.

How to proceed from here?

I'm willing to spend time on this, but at the moment I'm stuck.  So
if somebody could say something to unstick me, I'd be very grateful.
-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-06 14:56   ` Kai Großjohann
  2003-07-06 15:10     ` Kai Großjohann
@ 2003-07-07  3:39     ` Richard Stallman
  2003-07-07  5:58       ` Kai Großjohann
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2003-07-07  3:39 UTC (permalink / raw
  Cc: emacs-devel

    > Here is something fishy I found: after the last `R' command in dired,
    > dired-rename-file calls dired-rename-subdir, but the args specified
    > are not directories

    Shouldn't dired-rename-subdir be conditioned on either file or newname
    being a directory?

dired-rename-subdir ought to be harmless when the names are not
directories.  Is there positive reason to believe it causes any
trouble?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug in Ange-FTP with renaming files
  2003-07-07  3:39     ` Richard Stallman
@ 2003-07-07  5:58       ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-07-07  5:58 UTC (permalink / raw


Richard Stallman <rms@gnu.org> writes:

>     Shouldn't dired-rename-subdir be conditioned on either file or newname
>     being a directory?
>
> dired-rename-subdir ought to be harmless when the names are not
> directories.  Is there positive reason to believe it causes any
> trouble?

Originally, I saw an error when dired-rename-subdir was called with
non-directories.  That caused me to think it caused trouble.

But meanwhile, I believe that the trouble must be somewhere else --
even when avoiding dired-rename-subdir on non-directories, I get an
error.  (The same error, in fact: Ange-FTP issues "cd foo" where foo
is a file and not a directory.)
-- 
~/.signature

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-07-07  5:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-06 14:30 Bug in Ange-FTP with renaming files Kai Großjohann
2003-07-06 14:48 ` Kai Großjohann
2003-07-06 14:56   ` Kai Großjohann
2003-07-06 15:10     ` Kai Großjohann
2003-07-06 16:00       ` Kai Großjohann
2003-07-07  3:39     ` Richard Stallman
2003-07-07  5:58       ` Kai Großjohann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).