GNU bug report logs - #10472
`realpath --relative-to=<path> /` outputs inconsistent trailing slash

Previous Next

Package: coreutils;

Reported by: Mike Frysinger <vapier <at> gentoo.org>

Date: Tue, 10 Jan 2012 20:17:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 10472 <at> debbugs.gnu.org
Subject: bug#10472: [PATCH] realpath: fix problems with // handling
Date: Wed, 14 Mar 2012 09:12:57 +0000
On 03/14/2012 04:07 AM, Eric Blake wrote:
> On 03/13/2012 09:15 PM, Eric Blake wrote:
>>> Also doesn't path_prefix() need the same adjustment,
>>> so as to verify --relative-base in the same way?
>>
>> Yes, it looks like it.
> 
> In fact, I found another bug, this time present also on Linux:
> 
> $ realpath --relative-base=/ --relative-to=/ /
> /

This may be a local issue?
$ src/realpath --relative-base=/ --relative-to=/ /
.

> 
> when it should really output '.' (since '/' relative to itself is '.',
> and ALL files are below '/' [except when '//' is special]).  Likewise:
> 
> $ realpath --relative-base=/usr/local --relative-to=/usr \
>     /usr /usr/local/lib
> /usr
> /usr/local/lib
> 
> when it should really output '/usr' (absolute, since it is not a child
> of /usr/local) and 'local/lib' (which is a file below /usr/local, and an
> output name relative to /usr).

Well that was by design. I.E. --relative-base is a guard,
which if either --relative-to or the specified paths go higher,
an absolute name will be output.

cheers,
Pádraig.




This bug report was last modified 13 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.