delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/08/03/03:08:20

Date: 03 Aug 2003 08:18:56 +0200
Message-Id: <uk79vs1pr.fsf@elta.co.il>
From: Eli Zaretskii <eliz AT elta DOT co DOT il>
To: "Andrew Cottrell" <AndrewCottrell AT swiftdsl DOT com DOT au>
CC: djgpp-workers AT delorie DOT com
In-reply-to: <000001c35961$76c1d4a0$0101a8c0@acp42g>
(AndrewCottrell AT swiftdsl DOT com DOT au)
Subject: Re: mv bug (filutils? library?)
References: <000001c35961$76c1d4a0$0101a8c0 AT acp42g>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Andrew Cottrell" <AndrewCottrell AT swiftdsl DOT com DOT au>
> Date: Sun, 3 Aug 2003 11:49:17 +1000
> 
> I have traced the problem so far to the rename() in move.c which is in
> LIBC!!!! The problem line is:-
> 
>       if (rename (src_path, dst_path)== 0)
> 	  if (x->verbose && S_ISDIR (src_type))
> 	    printf ("%s -> %s\n", quote_n (0, src_path), quote_n (1, dst_path));
> 
> Here is my debugging printf() output is:-
> 
> DJ204 D:\dj204\gnu\filutil4.1\src\Test
> Test11>\dj204\gnu\filutil4.1\src\mv.exe -v junk1 junk1
> movefile (char *source = junk1, char *dest= junk1, int dest_is_dir = 1,
> const struct cp_options *x)
> mv.c 345
>  base_name(source = junk1)
>  path_concat (dest = junk1, src_basename = junk1, NULL)
> new_dest result junk1/junk1, x
> do_move (source = junk1, new_dest = junk1/junk1, x
> mv.c 171 : source = junk1 dest = junk1/junk1
> copy.c 1296 copy_into_self = TRUE
> copy.c 599 copy_into_self = TRUE
> copy.c 604 copy_into_self = FALSE
> copy.c 632
> copy.c 635
> copy.c 644
> copy.c 796
> copy.c 849
> copy.c 853 rename(src_path = junk1, dst_path = junk1/junk1
> copy.c 856 rename(src_path = junk1, dst_path = junk1/junk1) == False
> copy.c 870
> copy.c 891
> mv: cannot move `junk1' to a subdirectory of itself, `junk1/junk1'
> copy.c 899 copy_into_self = TRUE
> mv.c 181
> mv.c 185
> mv.c 189
> mv.c 238
> mv.c 270
> mv.c 272
> result = True

I don't get it: this sounds like `mv' has rightfully detected that it
cannot make this move, and refused to do so, isn't it?  The message
"cannot move `junk1' to a subdirectory of itself" seems to suggest
that.

Also, when the problem happened to me (I did see it on XP), what you
have after `mv' exits is not just junk1/junk1, but
junk1/junk1/junk1/...  etc., ad nauseum.

The error message is also different: I get EPERM after, presumably,
the combined length of the file name exceeds the Windows 255-character
limit.

Finally, if `rename' in the library is the culprit, there's a
machinery there that's supposed to detect this kind of situation and
return a suitable `errno' value.  IIRC, that machinery is based on
`_truename', so perhaps `_truename' returns something unexpected in
this case.  Please try to step into `rename' and see what happens
there.

TIA

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019