Gentoo Archives: gentoo-musl

From: Lei Zhang <zhanglei.april@×××××.com>
To: gentoo-musl@l.g.o, Luca Barbato <lu_zero@g.o>
Subject: [gentoo-musl] realpath() gives wrong result on a chroot musl system
Date: Mon, 06 Jun 2016 14:11:22
Message-Id: CAOYuCc3bH=KqAH6M+cuH2h+7MGDR9eW06SUYSwfbVF_xGj-rkw@mail.gmail.com
1 Hi,
2
3 I was trying to run clang (built specifically for musl) on a chroot
4 musl system, and met some strange issue. After some investigation, it
5 turns out the function realpath() is giving me wrong results.
6
7 I can reproduce the error with the following code snippet:
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <limits.h>
12
13 int main(int argc, char** argv) {
14 const char* path = "/usr/bin/clang"; // suppose this is a valid path
15 char resolved[PATH_MAX];
16 char* ret = realpath(path, resolved);
17
18 if (ret)
19 printf("%s\n", ret);
20 }
21
22 If I build it against musl, it gives correct result on my host, but
23 wrong result on chroot; If I build it against glibc (statically, since
24 there's no glibc on chroot), it gives correct results on both
25 environments. So it looks like musl is to blame on the chroot
26 environment. I haven't yet confirmed if it's a bug.
27
28 Any thoughts?
29
30 BTW, I built my musl system with the GRS tool, using the
31 desktop-amd64-musl-hardened profile.
32
33
34 Regards,
35 Lei

Replies

Subject Author
Re: [gentoo-musl] realpath() gives wrong result on a chroot musl system "Anthony G. Basile" <blueness@g.o>
Re: [gentoo-musl] realpath() gives wrong result on a chroot musl system Felix Janda <felix.janda@××××××.de>