From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A427913829C for ; Tue, 7 Jun 2016 00:19:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CDA69254029; Tue, 7 Jun 2016 00:19:43 +0000 (UTC) Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5BB7B254029 for ; Tue, 7 Jun 2016 00:19:43 +0000 (UTC) Received: by mail-oi0-f67.google.com with SMTP id k63so1524832oib.2 for ; Mon, 06 Jun 2016 17:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oyN1H/UkJ2wvGWucmNJZ7tIduIZor+W4v36P+EuKSQs=; b=pljxCCiXC/vz8oi7I8rJyTB7k6qGKlxezowrJ56eYnPYEEC1+2mmkV/14bEKRRP28r cVJEGptOONsRL8+neMCUgNkP2kr8qlg55OXTKhq+B7PL9SFRevJtlZeCVzCyZg+9ChgP ijOHWgpynuopXI/MzaQ8qU/WoXCW+lUi6AhmGDcxnif3kuDoDlQ6jJEtHZgx9eU5svF2 R0M2YgU1w9lUQ+JRdOaAD6WJFHDQgeIQhG0j/SHssYgFWRgLOCURLPHKMv/L0YoD7W18 krem9FznZJjsvThqkqN1dc9RbVyoU7DJl22icNRc8sv8QNIOmJfZTJgODwcNI7U4u+S9 SPtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oyN1H/UkJ2wvGWucmNJZ7tIduIZor+W4v36P+EuKSQs=; b=hdgtlwNsFJe1v3InZLmeowMx43muP1y8qS/x+CtEW4KINXb+CqGAonJRzzje8NcE2v TIHUpbZCNZ2XZIOqBUO1tC7tRdJr16Hl9xhBpTG1b5/HZ+vBEcToL2kqiDou1L6U+Fea YT69hSxgS98lI26Oph9fnvCqUdasKqUNTVtzvhRhsWGz5NU9hui1KPsTIp+OxWveZ6o5 qLeybuPkx30i+V5PNN6GNS9v7ej6NkER3oNuinCzD21JVZ8VC56R/YgYbhl5Cymz1bFg zy4drAWl9GNrUA+rhIUC9gGCCShW2gSo4EJYYgaJ7SrwFEcydft3YWUzgYJIW8GaKssV /AOw== X-Gm-Message-State: ALyK8tKvRybU8E9dTExrPMMC5+j2CUdrehDWrdnIGrsxUYBO3R6pfL76snHNq//pwxiUli7Kg9GTFW4Pt4h9tg== X-Received: by 10.157.27.173 with SMTP id z42mr10403799otd.192.1465258782401; Mon, 06 Jun 2016 17:19:42 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo musl list X-BeenThere: gentoo-musl@gentoo.org X-BeenThere: gentoo-musl@lists.gentoo.org MIME-Version: 1.0 Received: by 10.202.63.212 with HTTP; Mon, 6 Jun 2016 17:19:41 -0700 (PDT) In-Reply-To: <20160606220452.GA461@nyan> References: <20160606220452.GA461@nyan> From: Lei Zhang Date: Tue, 7 Jun 2016 08:19:41 +0800 Message-ID: Subject: Re: [gentoo-musl] realpath() gives wrong result on a chroot musl system To: Felix Janda Cc: gentoo-musl@lists.gentoo.org, Luca Barbato Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: 2a34ef57-1f03-44cd-8beb-cd5a6dfe0093 X-Archives-Hash: 92a1a33918ae50164f4fc17e0342ff98 2016-06-07 6:04 GMT+08:00 Felix Janda : > Lei Zhang wrote: >> Hi, >> >> I was trying to run clang (built specifically for musl) on a chroot >> musl system, and met some strange issue. After some investigation, it >> turns out the function realpath() is giving me wrong results. >> >> I can reproduce the error with the following code snippet: >> >> #include >> #include >> #include >> >> int main(int argc, char** argv) { >> const char* path = "/usr/bin/clang"; // suppose this is a valid path >> char resolved[PATH_MAX]; >> char* ret = realpath(path, resolved); >> >> if (ret) >> printf("%s\n", ret); >> } >> >> If I build it against musl, it gives correct result on my host, but >> wrong result on chroot; If I build it against glibc (statically, since >> there's no glibc on chroot), it gives correct results on both >> environments. So it looks like musl is to blame on the chroot >> environment. I haven't yet confirmed if it's a bug. >> >> Any thoughts? > > With musl, realpath() (and some other things) depend on having a > mounted /proc. You're right! After mounting /proc on the chroot system, the issue is resolved. At this point I'm really not sure if this is musl's bug. Is it legit to unconditionally depends on the presence of a mounted /proc? Lei