bug-grep
[Top][All Lists]
Advanced

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

Re: MS-Windows build of Grep [2/4]


From: Eli Zaretskii
Subject: Re: MS-Windows build of Grep [2/4]
Date: Fri, 30 Dec 2011 13:10:03 +0200

> From: Jim Meyering <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,  address@hidden,  address@hidden
> Date: Fri, 30 Dec 2011 11:37:59 +0100
> 
> I find the new semantics undesirable.
> SAME_INODE as a boolean is easy to read.
> When it becomes ternary, you have to handle the new possibility
> of non-POSIX file systems.  That is such a fundamental difference,
> that it would require significant change to sensitive parts of
> coreutils and gnulib.  I really do not want to invest in supporting
> such a platform when doing so will (at the very least) clutter up
> already involved code with new bits to handle this unusual case.

Personally, I see no need for doing anything special about SAME_INODE
on behalf of MS-Windows, and I don't really understand why Paul saw a
need for a change.  All that's needed is that SAME_INODE returns zero
when both inodes are zero.  Currently, this is done in src/main.c, but
you can move this test to SAME_INODE, and be done. 

> Eventually no-inode systems will go away (in a way, they're already
> gone), and when they are no longer worth supporting in grep I would
> like to be able to remove any old support easily.

Actually, there are no "no-inode systems" that I'm aware of.

MS-Windows is not a "no-inode system".  There _are_ inodes on Windows
filesystems (e.g., you will see that Emacs on MS-Windows does provide
an inode for each file and directory), it's just that the `stat' and
`fstat' in the Microsoft libraries don't bother to produce them.

However, it's quite doable to have a replacement `stat' and `fstat'
(e.g., in gnulib) that will provide meaningful inodes on MS-Windows.
The only difficulty with this is that the Windows inodes are 64-bit
numbers, while sys/stat.h provided by MinGW and MSVC compilers uses a
short int for st_inode.  But since gnulib provides a replacement
sys/stat.h as well, this problem is solvable.  (No, I don't plan on
working on this any time soon, but someone else might reuse the code
we have in Emacs and do this.)  When such a solution is available, the
Windows build will "just work" in this regard.

(And in case you are wondering, the MS-DOS build already has
meaningful inodes, because the DJGPP library it uses implements `stat'
and `fstat' that provide them.)

Bottom line: just add a test against zero inodes to SAME_INODE, and be
done.  You can then remove the test in main.c for that, as a bonus.



reply via email to

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