From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12219 Path: news.gmane.org!.POSTED!not-for-mail From: Natanael Copa Newsgroups: gmane.linux.lib.musl.general Subject: bug with sysconf(_SC_CHILD_MAX) with user process ulimit set to unlimited Date: Thu, 7 Dec 2017 16:26:09 +0100 Message-ID: <20171207162609.45e02f83@ncopa-desktop.copa.dup.pw> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1512660390 5628 195.159.176.226 (7 Dec 2017 15:26:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Dec 2017 15:26:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12235-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 07 16:26:24 2017 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 1eMy47-0001K6-S4 for gllmg-musl@m.gmane.org; Thu, 07 Dec 2017 16:26:23 +0100 Original-Received: (qmail 32082 invoked by uid 550); 7 Dec 2017 15:26:29 -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 32048 invoked from network); 7 Dec 2017 15:26:28 -0000 X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:12219 Archived-At: Hi, While trying to debug why `bash -c 'sleep 1 & wait $!'` hangs with alpine in docker[1] I made an interesting discovery. Set user process ulimit to "unlimited" and run the following program on an x86_64 machine: #include #include int main() { long maxchild = sysconf(_SC_CHILD_MAX); printf("maxchild: %ld\n", maxchild); return 0; } With musl libc it prints: maxchild: 9223372036854775807 With glibc it prints: maxchild: -1 Setting the process ulimit to something like 64k makes bash work again. Shouldn't sysconf(_SC_CHILD_MAX) return -1 if ulimit is set to "unlimited"? Thanks! -nc [1]: https://github.com/tianon/docker-bash/issues/4