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: Jim Meyering
Subject: Re: MS-Windows build of Grep [2/4]
Date: Fri, 30 Dec 2011 12:28:40 +0100

Eli Zaretskii wrote:
>> 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.

No change needed?

> All that's needed is that SAME_INODE returns zero
> when both inodes are zero.

But that would be a change.

> Currently, this is done in src/main.c, but
> you can move this test to SAME_INODE, and be done.

I explained why such a change does not belong in SAME_INODE.

>> 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.

Depends on your definition.
For me, it's when *stat functions do not provide POSIX-mandated stat.st_ino.

> 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.

That is the problem.

> 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.

Good to hear.

> (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.

As explained at length, I prefer not to change the semantics of SAME_INODE.



reply via email to

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