From: Lei Zhang <zhanglei.april@gmail.com>
To: Felix Janda <felix.janda@posteo.de>
Cc: gentoo-musl@lists.gentoo.org, Luca Barbato <lu_zero@gentoo.org>
Subject: Re: [gentoo-musl] realpath() gives wrong result on a chroot musl system
Date: Tue, 7 Jun 2016 09:44:15 +0800 [thread overview]
Message-ID: <CAOYuCc1VO=ni1mbWAuxVvFgdzGtsBNBBXqXm2tfZYPxVVUsoOw@mail.gmail.com> (raw)
In-Reply-To: <CAOYuCc0ry8DqnkHT9Bo-v7nbV6zj+Qw4JW6twNwL=pk07grqRw@mail.gmail.com>
2016-06-07 8:19 GMT+08:00 Lei Zhang <zhanglei.april@gmail.com>:
> 2016-06-07 6:04 GMT+08:00 Felix Janda <felix.janda@posteo.de>:
>> 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 <stdio.h>
>>> #include <stdlib.h>
>>> #include <limits.h>
>>>
>>> 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?
Answer from musl's mailing list: www.openwall.com/lists/musl/2016/06/07/2
Lei
next prev parent reply other threads:[~2016-06-07 1:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 14:11 [gentoo-musl] realpath() gives wrong result on a chroot musl system Lei Zhang
2016-06-06 15:23 ` Anthony G. Basile
2016-06-06 22:04 ` Felix Janda
2016-06-07 0:19 ` Lei Zhang
2016-06-07 1:44 ` Lei Zhang [this message]
[not found] ` <b08c7775-50c5-db8b-c5b2-211ab0600e02@gentoo.org>
2016-06-07 0:05 ` [gentoo-musl] " Lei Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOYuCc1VO=ni1mbWAuxVvFgdzGtsBNBBXqXm2tfZYPxVVUsoOw@mail.gmail.com' \
--to=zhanglei.april@gmail.com \
--cc=felix.janda@posteo.de \
--cc=gentoo-musl@lists.gentoo.org \
--cc=lu_zero@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox