bug-coreutils
[Top][All Lists]
Advanced

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

Re: vfat lost file problem


From: Jim Meyering
Subject: Re: vfat lost file problem
Date: Sun, 17 Aug 2003 23:14:12 +0200

Raistlin <address@hidden> wrote:
> Kernel Version:
> Linux debian 2.4.21 #6 SMP Wed Aug 6 11:55:01 CEST 2003 i686 GNU/Linux
> mv command Version:
> mv (coreutils) 5.0.90
>
> I've discovered that if you try to change the name of a file in a vfat
> partition only changing upper or lower case the file immediatly
> disappears.
>
> Example:
> If we have the file a.txt and we want to rename it like A.txt if we use
> the mv command `mv a.txt A.txt` the file a.txt (and also A.txt) are
> deleted.
>
> I hope I helped you; let me know if it's so (i'm not subscribed to the
> mailing list)

Thank you for reporting that, first to Debian, and again here!

This is indeed a problem.
It comes down to the following code from src/copy.c:

  if (x->move_mode || x->unlink_dest_before_opening)
    {
      if (S_ISLNK (dst_sb_link->st_mode))
        return 1;

      if (same_link && !same_name (src_path, dst_path))
        {
          if (x->move_mode)
            {
              *unlink_src = 1;           /* ********* */
              *return_now = 1;           /* ********* */
            }
          return 1;
        }
    }

The lines marked with comments end up being executed
because the same_name function reports that a.txt and A.txt
are different.  The problem is that with vfat, they refer
to the same file.  I'm not yet sure what to do about this.
One possibility is to detect when the destination file
system is of type vfat, and to disable the above code in
that case.  Maybe there's a more general approach...

I believe something similar happens with file names
that are too long.




reply via email to

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