From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10554 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general,gmane.comp.version-control.git Subject: Regression: git no longer works with musl libc's regex impl Date: Tue, 4 Oct 2016 11:08:48 -0400 Message-ID: <20161004150848.GA7949@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1475593755 10884 195.159.176.226 (4 Oct 2016 15:09:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Oct 2016 15:09:15 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: git@vger.kernel.org Original-X-From: musl-return-10567-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 04 17:09:08 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1brRL7-0001kl-E5 for gllmg-musl@m.gmane.org; Tue, 04 Oct 2016 17:09:05 +0200 Original-Received: (qmail 7246 invoked by uid 550); 4 Oct 2016 15:09:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7214 invoked from network); 4 Oct 2016 15:09:02 -0000 Content-Disposition: inline Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10554 gmane.comp.version-control.git:306073 Archived-At: This commit broke support for using git with musl libc: https://github.com/git/git/commit/2f8952250a84313b74f96abb7b035874854cf202 Rather than depending on non-portable GNU regex extensions, there is a simple portable fix for the issue this code was added to work around: When a text file is being mmapped for use with string functions which depend on null termination, if the file size: 1. is nonzero mod page size, it just works; the remainder of the last page reads as zero bytes when mmapped. 2. if an exact multiple of the page size, then instead of directly mmapping the file, first mmap a mapping 1 byte (thus 1 page) larger with MAP_ANON, then use MAP_FIXED to map the file over top of all but the last page. Now the mmapped buffer can safely be used as a C string. If such a solution is acceptable I can try to prepare a patch. Rich