Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-File CPAN distribution.

Report information
The Basics
Id: 84582
Status: open
Priority: 0/
Queue: Test-File

People
Owner: BAREFOOT [...] cpan.org
Requestors: abe [...] debian.org
Cc: CARNIL [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: symlink_target_{exists,dangles}_ok incorrectly fail on relative symlinks if they're not in the current directory
Date: Thu, 11 Apr 2013 21:58:30 +0200
To: bug-Test-File [...] rt.cpan.org
From: Axel Beckert <abe [...] debian.org>
Hi, I ran over the following issue in Test::File in Debian Squeeze (6.0, current stable release, Test::File 1.29) as well as Debian Wheezy (7.0, upcoming stable release, Test::File 1.34), initially reported at http://bugs.debian.org/705242 in Debian. The symlink_target_exists_ok and symlink_target_dangles_ok tests errornously fail if the symlink to test is a relative one and not based in the current directory. Example script which fails but shouldn't: ---snip--- #!/usr/bin/perl use strict; use Test::File; use File::Path qw(mkpath); chdir('/tmp'); mkpath('foo/bar/fnord', {}); my $rc = symlink('fnord', 'foo/bar/blafasel'); my $pwd = `pwd -P`; chomp($pwd); print "RC=$rc; CWD=$pwd\n"; system('ls -ld foo/bar/*'); symlink_target_exists_ok( 'foo/bar/blafasel' ); ---snap--- Output here: RC=0; CWD=/tmp lrwxrwxrwx 1 abe abe 5 Apr 11 21:21 foo/bar/blafasel -> fnord drwxr-xr-x 2 abe abe 4096 Apr 11 21:16 foo/bar/fnord # Symlink [foo/bar/blafasel] points to non-existent target [fnord]! not ok 1 - foo/bar/blafasel is a symlink # Failed test 'foo/bar/blafasel is a symlink' # at /tmp/testfile.pl line 14. # Tests were run but no plan was declared and done_testing() was not seen. In the source code of symlink_target_exists_ok there is nothing which takes care about links being relative to their parent directory. The link target is taken as relative to the current directory instead of the symlink's parent directory: [...] my $dest = shift || readlink( $file ); [...] unless( -e $dest ) { [...] symlink_target_dangles_ok has the same bug, too: [...] my $dest = readlink( $file ); [...] if( -e $dest ) { [...] -- System Information: Debian Release: 6.0.7 APT prefers stable APT policy: (990, 'stable'), (500, 'stable-updates'), (101, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-xen-amd64 (SMP w/6 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libtest-file-perl depends on: ii perl 5.10.1-17squeeze6 Larry Wall's Practical Extraction libtest-file-perl recommends no packages. libtest-file-perl suggests no packages. -- no debconf information Regards, Axel -- ,''`. | Axel Beckert <abe@debian.org>, http://people.debian.org/~abe/ : :' : | Debian Developer, ftp.ch.debian.org Admin `. `' | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE `- | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5
Show quoted text
> The symlink_target_exists_ok and symlink_target_dangles_ok tests > errornously fail if the symlink to test is a relative one and not > based > in the current directory.
Thanks for the very complete error report! I'll try to care of this problem ASAP.