[Top][All Lists]

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

Re: Windows same_file macro not reliable/usable when using Visual Stdudi

From: Eli Zaretskii
Subject: Re: Windows same_file macro not reliable/usable when using Visual Stdudio
Date: Sun, 26 Feb 2017 18:11:56 +0200

> From: Kees Dekker <address@hidden>
> Date: Thu, 23 Feb 2017 16:24:04 +0000
> I don't have the full knowledge and (even more important) the time to make 
> Cygwin 
> alike inode implementation. So I'm willing to make a git patch for the code I 
> provided, 
> but not able to make something that let get windows more close to POSIX 
> behavior.
> It is almost a design decision to choose to what level Windows should behave 
> like
> POSIX systems.

Modern MS-Windows filesystems do have an equivalent of an inode, and
also of uid and gid of the file's owner, but the implementations of
'stat' and 'fstat' in the MS C runtime libraries don't return this
information.  It is possible to obtain that information, but it would
require a more-or-less complete replacement of 'stat' and 'fstat', and
also replacement of 'struct stat', because the replacement inode
values are (AFAIR) 48-bit values, whereas the inode field in stock MS
'struct stat' is just 16-bit wide.

An example of such a replacement can be found in the Emacs sources.

A simpler solution would be to return zero from same_file if both
files have inode values of zero.  I think such values are impossible
on Posix systems, but if they are, then this could be a Windows
specific definition of the macro (system.h in Diffutils is already
prepared to support a build which defines a non-default macro).

There's no such easy solution for same_file_attributes, but AFAICT
that macro is only called by Diffutils if same_file returns non-zero,
so taking care of the latter will also resolve the problem with the


reply via email to

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