darcs

Issue 1057 pull fails to report "Can't pull from current repository" when pulling via symbolic link

Title pull fails to report "Can't pull from current repository" when pulling via symbolic link
Priority wishlist Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur
Assigned To
Topics

Created on 2008-09-04.21:12:56 by thorkilnaur, last changed 2009-08-27.14:19:08 by admin.

Files
File name Uploaded Type Edit Remove
test_for_issue_1057.dpatch.gz thorkilnaur, 2008-09-04.21:26:38 application/x-gzip
Messages
msg5908 (view) Author: thorkilnaur Date: 2008-09-04.21:12:54
pull fails to report "Can't pull from current repository" when the darcs repository pulled from is identified by a path 
that contains symbolic links. The problem seems to be in the code that tests this condition in 
src/Darcs/Commands/Pull.lhs:

>   here <- getCurrentDirectory
>   let repodirs = nub $ filter (/= here) $ map (fixUrl opts) unfixedrepodirs in do
>   -- Test to make sure we aren't trying to pull from the current repo
>   when (null repodirs) $
>         fail "Can't pull from current repository!"

Here, "here" is an absolute directory path, whereas "map (fixUrl opts) unfixedrepodirs" may contain directory paths with 
symbolic links. Hence, the fact that "here" really identifies the same directory as one of the paths in "map (fixUrl opts) 
unfixedrepodirs" may escape detection.

Best regards
Thorkil
msg5909 (view) Author: thorkilnaur Date: 2008-09-04.21:26:38
Here is a patch that adds a test for this issue.

Best regards
Thorkil
Attachments
msg5911 (view) Author: droundy Date: 2008-09-04.23:00:21
I don't think I'd call this a bug.

David
msg5916 (view) Author: thorkilnaur Date: 2008-09-05.05:14:51
Just to put a little perspective on this issue: I ran into this problem when I had placed a darcs darcs 
repository in a directory which I referred to using a directory path with a symbolic link in it. This caused the 
pull.sh test to fail: pull.sh contains the check (that I copied):
 
> #return special message when you try to pull from yourself
> DIR=`pwd`> not darcs pull --debug -a "$DIR" 2> out
> cat out
> grep 'Can.t pull from current repository' out

So, when $DIR contains symbolic links, this check causes pull.sh to fail.

This particular problem can be solved, at least on Mac OS X, by using

> DIR=`pwd -P`

which causes $DIR to become an absolute path with symbolic links resolved.

Best regards
Thorkil
msg5968 (view) Author: droundy Date: 2008-09-09.16:22:58
The following patch updated the status of issue1057 to be resolved:

* resolve issue1057: this was fixed in the previous patch.
History
Date User Action Args
2008-09-04 21:12:56thorkilnaurcreate
2008-09-04 21:26:40thorkilnaursetfiles: + test_for_issue_1057.dpatch.gz
status: unread -> unknown
messages: + msg5909
2008-09-04 23:00:23droundysetpriority: bug -> wishlist
nosy: + droundy
messages: + msg5911
2008-09-05 05:14:53thorkilnaursetnosy: droundy, kowey, dagit, thorkilnaur
messages: + msg5916
2008-09-09 16:23:00droundysetstatus: unknown -> resolved-in-unstable
nosy: droundy, kowey, dagit, thorkilnaur
messages: + msg5968
2009-04-22 03:34:38twbsetstatus: resolved-in-unstable -> resolved
nosy: + dmitry.kurochkin, simon
2009-08-06 18:00:11adminsetnosy: + markstos, jast, Serware, darcs-devel, zooko, mornfall, tommy, beschmi, - droundy
2009-08-06 21:12:22adminsetnosy: - beschmi
2009-08-10 21:48:16adminsetnosy: - tommy, markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-10 23:44:48adminsetnosy: - dagit
2009-08-25 17:44:33adminsetnosy: + darcs-devel, - simon
2009-08-27 14:19:08adminsetnosy: kowey, darcs-devel, thorkilnaur, dmitry.kurochkin