From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10097 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: realpath() depends on a mounted /proc to work Date: Mon, 6 Jun 2016 21:15:39 -0400 Message-ID: <20160607011538.GU10893@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1465262156 4124 80.91.229.3 (7 Jun 2016 01:15:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jun 2016 01:15:56 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10110-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 07 03:15:56 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1bA5cX-0005Vi-BK for gllmg-musl@m.gmane.org; Tue, 07 Jun 2016 03:15:53 +0200 Original-Received: (qmail 20037 invoked by uid 550); 7 Jun 2016 01:15:51 -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 20017 invoked from network); 7 Jun 2016 01:15:51 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10097 Archived-At: On Tue, Jun 07, 2016 at 08:27:18AM +0800, Lei Zhang wrote: > Hi, > > I observed that realpath() doesn't work correctly without a mounted > /proc while experimenting in a chroot system, where musl is the > default libc. OTOH, the same program statically linked against glibc > worked just as expected. > > Is the dependence on a mounted /proc intentional? Then what's the > rationale behind it? As a whole, musl depends on having /proc; the rationale is simply that Linux does not expose all the functionality needed to implement POSIX without /proc. As for realpath, it could be done without /proc, but being that musl already requires /proc for full functionality, and that non-/proc versions of realpath are significantly heavier, more complex, and less reliable, simply using /proc for realpath was the natural choice. If someone wants to do a survey of what functionality actually depends on /proc, we could document that and also evaluate whether realpath is sufficiently more "basic" than other things which need /proc that we might want to consider having a fallback implementation for when /proc is missign. Rich