zsh-workers
 help / color / mirror / code / Atom feed
* Re: Absolute path of a path
       [not found]         ` <20101028105250.GB7283@prunille.vinc17.org>
@ 2010-10-28 12:44           ` Benjamin R. Haskell
  0 siblings, 0 replies; only message in thread
From: Benjamin R. Haskell @ 2010-10-28 12:44 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1271 bytes --]

[moving to -workers]

> On 2010-10-28 12:44:51 +0200, Vincent Lefevre wrote:
>> FYI:
>>
>> ypig:~> realpath symlink/../vlefevre/symlink
>> /home/vlefevre
>>
>> ypig:~> echo symlink/../vlefevre/symlink(:A)
>> /home/vlefevre/vlefevre/symlink
>>
>> where symlink is a symbolic link to ".".
>
> I think that this is even a bug in zsh, as
>
> ypig:~> echo symlink/../vlefevre/symlink2(:A)
> zsh: no match
>
> So, it seems that resolution as been done correctly (it is detected 
> that symlink/../vlefevre/symlink exists but not 
> symlink/../vlefevre/symlink2), however the output for the former one 
> /home/vlefevre/vlefevre/symlink doesn't exist (there's no vlefevre 
> file or directory in /home/vlefevre).
>

FWIW, my Perl-based workaround does the right thing, as does the 
attached simple C program.  Seems like a bug.

$ echo $ZSH_VERSION $ZSH_PATCHLEVEL
4.3.10-dev-1 1.5015
$ pwd
/home/bhaskell/tmp
$ readlink symlink
.

$ echo symlink/../tmp/symlink(:A)
/home/bhaskell/tmp/tmp/symlink
## /home/bhaskell/tmp/tmp doesn't exist

$ A () { reply=("$(perl -MCwd=realpath -we 'print realpath shift' $REPLY)") }
$ echo symlink/../tmp/symlink(+A)
/home/bhaskell/tmp

$ gcc -Wall -o realpath-test{,.c}
$ ./realpath-test symlink/../tmp/symlink
/home/bhaskell/tmp

-- 
Best,
Ben

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-c; name=realpath-test.c, Size: 284 bytes --]

#include <limits.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
	char resolved[PATH_MAX];
	if (argc < 2) {
		fprintf(stderr, "Usage: %s path\n", argv[0]);
		return 1;
	}
	realpath(argv[1], resolved);
	printf("%s\n", resolved);
	return 0;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-28 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTikZN2Lk3zf2fWqD917TA-Wa5jCBQSZ-7VNWVOCj@mail.gmail.com>
     [not found] ` <AANLkTi=j_OtAziY1X=1qj=zk3P7=U6my1sd=bVshp69u@mail.gmail.com>
     [not found]   ` <20101027164454.GA19471@prunille.vinc17.org>
     [not found]     ` <AANLkTinLOXXBT=Wsu+gKLSEMgGGPg33c+_93CyS6xLsG@mail.gmail.com>
     [not found]       ` <20101028104451.GB19471@prunille.vinc17.org>
     [not found]         ` <20101028105250.GB7283@prunille.vinc17.org>
2010-10-28 12:44           ` Absolute path of a path Benjamin R. Haskell

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).