Re: [musl] Re: Regression: git no longer works with musl libc's regex impl
From: Rich Felker <dalias@libc.org>
Date: 2016-10-05 16:16:37
On Wed, Oct 05, 2016 at 03:11:05PM +0200, Jakub Narębski wrote:
W dniu 05.10.2016 o 00:33, Rich Felker pisze:quoted
On Wed, Oct 05, 2016 at 09:06:25AM +1100, James B wrote:quoted
On Tue, 4 Oct 2016 18:08:33 +0200 (CEST) Johannes Schindelin [off-list ref] wrote:quoted
No, it is not. You quote POSIX, but the matter of the fact is that we use a subset of POSIX in order to be able to keep things running on Windows. And quite honestly, there are lots of reasons to keep things running on Windows, and even to favor Windows support over musl support. Over four million reasons: the Git for Windows users.Wow, I don't know that Windows is a git's first-tier platform now, and Linux/POSIX second. Are we talking about the same git that was originally written in Linus Torvalds, and is used to manage Linux kernel? Are you by any chance employed by Redmond, directly or indirectly? Sorry - can't help it.Windows is one of the major platforms, yes. I think there much, much more people using Git on Windows, than using Git with musl. More users = more important. Also, working with some inconvenience (requiring compilation with NO_REGEX=1) is better than not working at all. In CodingGuidelines we say: - Most importantly, we never say "It's in POSIX; we'll happily ignore your needs should your system not conform to it." We live in the real world. - However, we often say "Let's stay away from that construct, it's not even in POSIX".
I agree wholeheartedly with these points.
- In spite of the above two rules, we sometimes say "Although this is not in POSIX, it (is so convenient | makes the code much more readable | has other good characteristics) and practically all the platforms we care about support it, so let's use it". The REG_STARTEND is 3rd point,
To begin with I wasn't clear that REG_STARDEND being nonstandard was even noticed or compatibility considered when adding the dependency on it, but it seems such discussion did take place and most targets have it. Perhaps this means it should be proposed for standardization in the next issue of POSIX.
mmap shenningans looks like 1st... ....on the other hand midipix [off-list ref] wrote in http://public-inbox.org/git/20161004200057.dc30d64f61e5ec441c34ffd4f788e58e.efa66ead67.wbe@email15.godaddy.com/ that the proposed fix should work on all Windows version we are interested in (I think). Test program included / attached. The above-mentioned email also explains that the problem was caught on MS Windows; it triggers if file end falls on the mmapped page boundary, which is more likely to happen with 4096 mod size on Windows rather than 65536 mod size on Linux.
On Linux page-size (mmap granularity) varies by arch but it's 4k on basically all archs that people care about. I think midipix's author was talking about real page size on Windows (4k) vs the minimum logical page size (mmap granularity) that can be used to get POSIX-matching semantics in midipix (which is 64k due to some technical reasons I forget, which he could probably remind me of).
On the other hand, while the proposed solution of "add padding as to not end at page boundary, if necessary" doesn't have the performance impact of "memcpy into NUL-terminated buffer" that was originally proposed in patch series, it is still extra code to maintain.
*nod* Rich