Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: >> Besides avoiding a segfault, one of the benefits of regcomp_buf() is >> that we will now find pickaxe-regex strings inside mixed binary/text >> files. But it's not clear to me that NetBSD's implementation does this. >> >> I guess we can assume it is fine (it is certainly no _worse_ than the >> current behavior), and if people's platforms do not handle it, they can >> build with NO_REGEX. > > René mentioned in f96e567 (grep: use REG_STARTEND for all matching if > available, 2010-05-22) something along the lines of REG_STARTEND being > able to parse beyond NULs. My interpretation of NetBSD's documentation > agrees with your interpretation, though, that the buffers are still > thought of as being NUL-terminated, even if rm_eo makes the code *not* > look at that particular NUL. > > Be that as it may: it is completely outside the purpose of my patch series > to take care of making it possible for Git's regex functions to match > buffers with embedded NULs. I think you two have agreed that regexec_buf() wrapper that always relies on REG_STARTEND is a good first step whether we want to do an embedded NUL, that we just need that good first step for now, and that that good first step would not block future progress, i.e. our wanting to handle embedded NUL. So let's see how well the first step flies in practice. We tell people to build with NO_REGEX if their platform's regexp does not do (any form of) REG_STARTEND. We _might_ later have to tell them to set NO_REGX even if they are on NetBSD and has REG_STARTEND that may not handle embedded NUL the way we want, but that can safely be left to the future. Thanks.