Bram Moolenaar wrote:

> Patch 7.2.076
> Problem:    rename(from, to) deletes the file if "from" and "to" are not equal
>            but still refer to the same file.  E.g., on a FAT32 filesystem
>            under Unix.
> Solution:   Go through another file name.
> Files:      src/fileio.c
>
>
> *** ../vim-7.2.075/src/fileio.c Fri Nov 28 21:26:50 2008
> --- src/fileio.c        Tue Dec 30 16:04:44 2008
> ***************
> *** 6119,6124 ****
> --- 6119,6165 ----
>      if (mch_stat((char *)from, &st) < 0)
>        return -1;
>
> + #ifdef UNIX
> +     {
> +       struct stat     st_to;
> +       char            tempname[MAXPATHL + 1];
> +
> +       /* It's possible for the source and destination to be the same file.
> +        * This happens when "from" and "to" differ in case and are on a FAT32
> +        * filesystem.  In that case go through a temp file name. */
> +       if (mch_stat((char *)to, &st_to) >= 0
> +               && st.st_dev == st_to.st_dev
> +               && st.st_ino == st_to.st_ino)
> +       {
[...]

Will the stat() technique to find whether 2 files are identical work on
all FAT file systems?

I think remembering that FAT file systems don't have the concept of
inodes, unlike Unix file systems, so stat() either leaves st_ino as  0,
or synthesizes a fake inode number.  I will try it later when I have time.

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui