public inbox for gentoo-musl@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-musl@lists.gentoo.org
Subject: Re: [gentoo-musl] realpath() gives wrong result on a chroot musl system
Date: Mon, 6 Jun 2016 11:23:07 -0400	[thread overview]
Message-ID: <d6f4d28f-bf36-2877-6bb0-a7c8ad76d568@gentoo.org> (raw)
In-Reply-To: <CAOYuCc3bH=KqAH6M+cuH2h+7MGDR9eW06SUYSwfbVF_xGj-rkw@mail.gmail.com>

On 6/6/16 10:11 AM, 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?
> 
> BTW, I built my musl system with the GRS tool, using the
> desktop-amd64-musl-hardened profile.
> 
> 
> Regards,
> Lei
> 

open a bug report with steps to reproduce.  realpath is spec-ed in
POSIX.1-2001, take a look at the opengroup page for it.  also print out
the errno in case one is set.



-- 
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : blueness@gentoo.org
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA


  reply	other threads:[~2016-06-06 15:23 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 [this message]
2016-06-06 22:04 ` Felix Janda
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=d6f4d28f-bf36-2877-6bb0-a7c8ad76d568@gentoo.org \
    --to=blueness@gentoo.org \
    --cc=gentoo-musl@lists.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