[darcs-devel] [issue2275] Darcs follows symbolic links instead of properly ignoring them

Gian Piero Carrubba bugs at darcs.net
Tue Dec 11 08:11:39 UTC 2012


New submission from Gian Piero Carrubba <gpiero at rm-rf.it>:

It seems that sometimes darcs follows symbolic links instead of ignoring 
them. It surely happens when substituting a recorded file with a 
symbolic link.

A description of the problem is appended below and a minimal test is 
attached.

Currently using v2.9.6, but I've found the same problem in 2.8 and, 
IIRC, also in 2.5. Could not test older versions.

Thanks,
Gian Piero.

----------- darcs version

$ darcs --exact-version
darcs compiled on Dec  4 2012, at 22:31:54
...
$ darcs --version 
2.9.6 (+ 26 patches)


----------- steps to reproduce

       # -- initialize the repository
$ darcs ini ; echo ImmutableFile > file ; darcs rec -lam init
Finished recording patch 'init'

       # -- add a test file and record the patch
$ echo TemporaryFile > maybeFile ; darcs rec -lam 'Add maybeFile'
Finished recording patch 'Add maybeFile'

       # -- remove the just added file and check that darcs recognizes the 
       # removal
$ rm maybeFile
$ darcs wh -s
R ./maybeFile
$ darcs wh -ls
R ./maybeFile

       # -- create a symbolic link with the same name of the just removed 
       # file pointing to an existent file (does not need to be in the 
       # repodir)
$ ln -s file maybeFile

       # -- now you get different opinions about what changed depending on 
       # the use of the '--look-for-adds' option. In both case 'maybeFile' 
       # is wrongly reported as changed (the current content of 'maybeFile' 
       # is assumed to be the one of the file the link points to), anyway 
       # using the '-l' option you also get the right information that 
       # 'maybeFile' has been removed.
$ darcs wh -s
M ./maybeFile -1 +1
$ darcs wh -ls
M ./maybeFile -1 +1
R ./maybeFile

       # -- trying to record the changes without the use of '-l' leads to 
       # the wrong patch being recorded
$ darcs rec -am 'Maybe remove maybeFile'
Finished recording patch 'Maybe remove maybeFile'
$ darcs cha --last 1 -s
Mon Dec 10 23:15:44 CET 2012  "Gian Piero Carrubba" <gpiero at rm-rf.it>
     * Maybe remove maybeFile

       M ./maybeFile -1 +1

       # -- unrecord the wrong patch
$ darcs unrec --last 1 -a
Finished unrecording.

       # -- passing '-l' to the record command leads to the right patch 
       # being  recorded.
$ darcs rec -lam 'Remove maybeFile'
Finished recording patch 'Remove maybeFile'
$ darcs cha --last 1 -s
Mon Dec 10 23:24:22 CET 2012  "Gian Piero Carrubba" <gpiero at rm-rf.it>
     * Remove maybeFile

       R ./maybeFile

       # -- now if you unrecord the last patch the `-l' option does not 
       # make a difference anymore
$ darcs unrec --last 1 -a
Finished unrecording.
$ darcs wh -s
R ./maybeFile
$ darcs wh -ls
R ./maybeFile

       # -- recreate the issue
$ darcs rec -lam 'Remove maybeFile'
Finished recording patch 'Remove maybeFile'
$ echo AnotherTemporaryFile > maybeFileTwo
$ darcs rec -lam 'Add maybeFileTwo'
Finished recording patch 'Add maybeFileTwo'
$ rm maybeFileTwo ; ln -s file maybeFileTwo

       # -- giving a hint to darcs about the removal of the file is another 
       # way for solving
$ darcs wh -s
M ./maybeFileTwo -1 +1
$ darcs wh -ls
M ./maybeFileTwo -1 +1
R ./maybeFileTwo
$ darcs remove maybeFileTwo
$ darcs wh -s
R ./maybeFileTwo
$ darcs wh -ls
R ./maybeFileTwo
$ darcs rec -am 'Remove maybeFileTwo'
Finished recording patch 'Remove maybeFileTwo'
$ darcs cha --last 1 -s
Tue Dec 11 00:37:10 CET 2012  "Gian Piero Carrubba" <gpiero at rm-rf.it>
     * Remove maybeFileTwo

       R ./maybeFileTwo

       # -- create again the issue, this time giving the file the same 
       # content of the file referenced by the link so that 'wh' will not 
       # report a modified file
$ echo ImmutableFile > maybeFileThree
$ darcs rec -lam 'Add maybeFileThree'
Finished recording patch 'Add maybeFileThree'
$ rm maybeFileThree ; ln -s file maybeFileThree

       # -- in this case 'wh' without '-l' reports no changes
$ darcs wh -s
No changes!
$ darcs wh -ls
R ./maybeFileThree
$ darcs rec -lam 'Remove maybeFileThree'
Finished recording patch 'Remove maybeFileThree'

       # -- create again the problem, pointing the symbolic link to a 
       # not-existent file
$ echo JustAnotherTemporaryFile > maybeFileFour
$ darcs rec -lam 'Add maybeFileFour'
Finished recording patch 'Add maybeFileFour'
$ rm maybeFileFour ; ln -s not-existent maybeFileFour

       # -- this time, darcs croaks
$ darcs wh -s
darcs: ...: openBinaryFile: does not exist (No such file or directory)
$ darcs wh -ls
darcs: ...: openBinaryFile: does not exist (No such file or directory)

       # -- cannot use the same workarounds that fixed the other cases
$ darcs remove maybeFileFour
darcs: ...: openBinaryFile: does not exist (No such file or directory)
$ darcs rec -lam 'Remove maybeFileFour'
darcs: ...: does not exist (No such file or directory)

       # -- remove the link seems the only way to go
$ rm maybeFileFour
$ darcs wh -s
R ./maybeFileFour
$ darcs wh -ls
R ./maybeFileFour

----------
files: issuexxxx.sh
messages: 16391
nosy: gpiero
status: unknown
title: Darcs follows symbolic links instead of properly ignoring them

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue2275>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: issuexxxx.sh
Type: application/x-sh
Size: 1861 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20121211/67d82790/attachment.sh>


More information about the darcs-devel mailing list