Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-01-14
06:23 • Ticket [1816166fff] file link -symbolic fails on some relative targets sta... artifact: 44bfded95a user: hobbs
2007-10-20
07:15 • Ticket [1816166fff]: 4 changes artifact: 5e4f6c3579 user: coldstore
2007-10-19
13:56 • Open ticket [1816166fff]. artifact: c7790b07e0 user: coldstore
11:29 • Pending ticket [1816166fff]. artifact: ed163ec3bb user: dgp
05:42 • Ticket [1816166fff]: 5 changes artifact: fecb1d3c18 user: andreas_kupries
2007-10-18
22:39 • New ticket [1816166fff]. artifact: ffc7544a86 user: coldstore

[file link -symbolic] fails on some relative targets

Open1816166fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-10-18 22:39:33
The following transcript illustrates a problem - none of the following commands should fail.

% file delete -force td
% file mkdir td
% file mkdir td/td1
% file link -symbolic td/l1 td/td1
could not create new link "td/l1": target "td/td1" doesn't exist
% file link -symbolic td/l1 ./td/td1
could not create new link "td/l1": target "./td/td1" doesn't exist
% file link -symbolic ./td/l1 ./td/td1
could not create new link "./td/l1": target "./td/td1" doesn't exist
% cd td
% file link -symbolic l1 ./td/td1
could not create new link "l1": target "./td/td1" doesn't exist
% file link -symbolic l1 ./td1
./td1
% file link -symbolic l2 ./td1
./td1
% cd ..
% file link -symbolic l3 ./td/td1
./td/td1
% file link -symbolic l4 td/td1
td/td1
%
andreas_kupriesplain2007-10-19 05:42:13
Logged In: YES 
user_id=75003
Originator: NO

Additional data point: With an 8.4.15 tclsh the script works.
dgpplain2007-10-19 11:29:24
Logged In: YES 
user_id=80530
Originator: NO


Please check how much this
is a Dup of 833713
and 951964
coldstoreplain2007-10-19 13:56:13
Logged In: YES 
user_id=19214
Originator: YES

similar to 833713 but instead of normalizing the link target, it errors out.
coldstoreplain2007-10-20 07:15:59
Logged In: YES 
user_id=19214
Originator: YES

The following comment in unix/tclUnixFile.c may explain the cause of the problem:

 * If we're making a symbolic link and the path is relative, then we
 * must check whether it exists _relative_ to the directory in which
 * the src is found (not relative to the current cwd which is just not
 * relevant in this case).

It seems that the link command interprets target relative to the target and not the cwd.

This is arguably idiosyncratic, but is at least coherent, and could probably be covered by making such behaviour explicit in the documentation.
hobbsplain2008-01-14 06:23:58
Logged In: YES 
user_id=72656
Originator: NO

Did the tester build with mingw-gcc or MSVC?  If gcc, this may be a dup of 1852661.
Log in (anonymous is fine) to add a comment.