1 |
On 6/6/16 10:11 AM, Lei Zhang wrote: |
2 |
> Hi, |
3 |
> |
4 |
> I was trying to run clang (built specifically for musl) on a chroot |
5 |
> musl system, and met some strange issue. After some investigation, it |
6 |
> turns out the function realpath() is giving me wrong results. |
7 |
> |
8 |
> I can reproduce the error with the following code snippet: |
9 |
> |
10 |
> #include <stdio.h> |
11 |
> #include <stdlib.h> |
12 |
> #include <limits.h> |
13 |
> |
14 |
> int main(int argc, char** argv) { |
15 |
> const char* path = "/usr/bin/clang"; // suppose this is a valid path |
16 |
> char resolved[PATH_MAX]; |
17 |
> char* ret = realpath(path, resolved); |
18 |
> |
19 |
> if (ret) |
20 |
> printf("%s\n", ret); |
21 |
> } |
22 |
> |
23 |
> If I build it against musl, it gives correct result on my host, but |
24 |
> wrong result on chroot; If I build it against glibc (statically, since |
25 |
> there's no glibc on chroot), it gives correct results on both |
26 |
> environments. So it looks like musl is to blame on the chroot |
27 |
> environment. I haven't yet confirmed if it's a bug. |
28 |
> |
29 |
> Any thoughts? |
30 |
> |
31 |
> BTW, I built my musl system with the GRS tool, using the |
32 |
> desktop-amd64-musl-hardened profile. |
33 |
> |
34 |
> |
35 |
> Regards, |
36 |
> Lei |
37 |
> |
38 |
|
39 |
open a bug report with steps to reproduce. realpath is spec-ed in |
40 |
POSIX.1-2001, take a look at the opengroup page for it. also print out |
41 |
the errno in case one is set. |
42 |
|
43 |
|
44 |
|
45 |
-- |
46 |
Anthony G. Basile, Ph.D. |
47 |
Gentoo Linux Developer [Hardened] |
48 |
E-Mail : blueness@g.o |
49 |
GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA |
50 |
GnuPG ID : F52D4BBA |