GNU bug report logs -
#25814
Windows same_file macro is not reliable
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi,
On file systems that do not support inodes (e.g. NTFS, because not everything is POSIX), the same_file() macro (in system.h) is incorrect as st_ino (and probably st_dev) are meaningless. See also https://msdn.microsoft.com/en- us/library/14h5k7ff.aspx<https://msdn.microsoft.com/en-%20us/library/14h5k7ff.aspx>. I would suggest to add an #ifdef _WIN32 macro that let return same_file() 0.
The same applies to same_file_attributes macro. The st_uid and st_gid fields are never set to a useful value on Windows (see MSDN URL as mentioned before).
The resulting suggested code would be:
#if _WIN32
# define same_file(s, t) 0
#else
# define same_file(s, t) \
((((s)->st_ino == (t)->st_ino) && ((s)->st_dev == (t)->st_dev)) \
|| same_special_file (s, t))
#endif
and
#ifndef same_file_attributes
#if _WIN32
# define same_file_attributes(s, t) 0
#else
# define same_file_attributes(s, t) \
((s)->st_mode == (t)->st_mode \
&& (s)->st_nlink == (t)->st_nlink \
&& (s)->st_uid == (t)->st_uid \
&& (s)->st_gid == (t)->st_gid \
&& (s)->st_size == (t)->st_size \
&& (s)->st_mtime == (t)->st_mtime \
&& (s)->st_ctime == (t)->st_ctime)
#endif
#endif
Since I'm unfamiliar with git, please check whether this change is feasible.
Regards,
Kees
[Message part 2 (text/html, inline)]
This bug report was last modified 8 years and 116 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.