public inbox for gentoo-musl@lists.gentoo.org
 help / color / mirror / Atom feed
From: Felix Janda <felix.janda@posteo.de>
To: Lei Zhang <zhanglei.april@gmail.com>
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 06:04:52 +0800	[thread overview]
Message-ID: <20160606220452.GA461@nyan> (raw)
In-Reply-To: <CAOYuCc3bH=KqAH6M+cuH2h+7MGDR9eW06SUYSwfbVF_xGj-rkw@mail.gmail.com>

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.

Felix


  parent reply	other threads:[~2016-06-06 22:05 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 [this message]
2016-06-07  0:19   ` Lei Zhang
2016-06-07  1:44     ` Lei Zhang
     [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=20160606220452.GA461@nyan \
    --to=felix.janda@posteo.de \
    --cc=gentoo-musl@lists.gentoo.org \
    --cc=lu_zero@gentoo.org \
    --cc=zhanglei.april@gmail.com \
    /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