Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 398339

Summary: sys-apps/coreutils-8.15: realpath --relative-to behaves strangely for "/" path
Product: Gentoo Linux Reporter: Ulrich Müller <ulm>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://lists.gnu.org/archive/html/bug-coreutils/2012-01/msg00083.html
Whiteboard:
Package list:
Runtime testing required: ---

Description Ulrich Müller gentoo-dev 2012-01-10 09:01:48 UTC
realpath with option --relative-to behaves strangely if one of the paths is "/".

$ realpath --relative-to=/ /usr
../usr

Expected Results:
It should return just "usr". Especially, ../usr will fail if it is subsequently  used with some nontrivial ${ROOT}.

$ realpath --relative-to=/usr /
../
$ realpath --relative-to=/usr/bin /usr
..

Expected Results:
It should behave consistently, i.e. always return ".." without the trailing slash.

$ realpath --version
realpath (GNU coreutils) 8.15
Packaged by Gentoo (8.15 (p1))
Comment 1 SpanKY gentoo-dev 2012-01-10 20:38:06 UTC
since this is new functionality, and i'd be hard pressed to say a bug that actually breaks anything, i'm inclined to mark UPSTREAM and let things progress naturally that way

you ok with that ?
Comment 2 Ulrich Müller gentoo-dev 2012-01-10 21:40:10 UTC
(In reply to comment #1)
> you ok with that ?

Yes.

One thing that I've noticed in your report upstream:

> as does these:
>         realpath --relative-to=/ /usr
>         realpath --relative-to=/ /usr/
> which is to say, they show:
>         ..

Both of these output "../usr" for me. (But ".." is wrong too, correct would be "usr".)
Comment 3 SpanKY gentoo-dev 2012-01-10 21:53:52 UTC
thanks ... i've followed up in my report with that info