Subject: bug#48081: [bug-diffutils] bug#48081: Acknowledgement (diff on windows doest work with same path but different drives)

From: Bruno Haible <[email-masked]>
Date: Fri, 30 Apr 2021 00:12:37 +0200

On 4/29/21 8:16 AM, [email-masked] wrote in https://bugs.gnu.org/48081 :
>> iam using many cloned virtual disk drives
>> which has same serial number (becase was cloned)

> > so i propose little fix for this
> > just edit at the file diffutils-3.7\lib\stat-w32.c
> > 
> > to "buf->st_dev" after assign "VolumeSerialNumber"
> > add disk drive letter

Nope. By using several disk drives with the same serial number, you
are outside the range of supportable situations.

The Windows API [1] describes dwVolumeSerialNumber as
  "The serial number of the volume that contains a file."
The term "serial number" implies that different volumes have different
serial numbers.

Fixing diffutils for native Windows would not help generally.

This Windows API is surely used by hundreds of programs. Many of
them will malfunction in your situation. For example, a disk management
program might, when you give it the instruction to format the second
disk, instead format the first disk.

Disk serial numbers are also used to make sure that the mount points
of two mounts in the file system don't change if you move the disks
to different USB ports (i.e. disk A on USB port 1 should mount in the
same place as when you plug it into USB port 2).

The only right fix is that you assign different serial numbers to your
disks. Only this will bring you back to a supported situation.

VirtualBox, for example, has a command to do this:
  VBoxManage internalcommands sethduuid copied-disk.vmdk

Bruno

[1] https://docs.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-by_handle_file_information