darcs

Issue 1240 Windows paths starting with backslash handled incorrectly

Title Windows paths starting with backslash handled incorrectly
Priority bug Status unknown
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, eivuokko, jaredj, kirby, kowey, steve.gardner, thorkilnaur, wglozer
Assigned To kirby
Topics FilePath, Windows

Created on 2008-11-24.11:13:04 by steve.gardner, last changed 2020-08-01.23:18:31 by bfrk.

Messages
msg6735 (view) Author: steve.gardner Date: 2008-11-24.11:13:01
Using "darcs-2.1.2+302.exe"
(from zooko.com/darcsbuildbot/uploads/zooko_allmydata_virtual2/snapshots/ ,
"Last modified" date 20-Nov-2008 14:58)
on Windows XP Pro SP3:
  C:
  cd \source
  darcs-2.1.2+302.exe send --context=\path\to\file.context --output=file.bundle .
  darcs-2.1.2+302.exe: C:/source/path/to/file.context: openBinaryFile: does not
exist (No such file or directory)

The context file was present at C:\path\to\file.context but darcs was ignoring
the initial backslash and treating the path as relative. There is no error if
the "C:" prefix is included.

"darcs-2.1.2+302.exe apply \path\to\file.bundle" gives the same error.
msg6738 (view) Author: thorkilnaur Date: 2008-11-24.16:05:47
Thank you very much. I hope that this confusing behavior has not wasted too much 
of your time. I presume that you are able to work around it.

I can confirm this behavior: With the stated "darcs-2.1.2+302.exe" on windows, 
an initial backslash (in fact, any number, apparently, of initial backslashes) 
on the filename following --context are apparently ignored. Although in the same  
neighborhood as issue950, it is not the same. In addition, the tested darcs has 
presumably been fixed with the patch for issue950.

So, we need a testcase for this. And a repair. Any volunteers?

Thanks a lot and best regards
Thorkil
msg6754 (view) Author: steve.gardner Date: 2008-11-28.13:23:49
Thorkil,

Thanks for your response.

I had a go at changing the darcs source (cabal build, darcs-2.1.2.2) and my
changes seemed to fix the problem. However, I'm not sure that it's the right
answer to the problem.

I made two small changes to the makeAbsolute function in Darcs/RepoPath.hs :

1) I changed "if is_absolute dir" to "if is_absolute cleandir", because
is_absolute only detects forward slashes.

2) I removed "slashes ++" because it was prepending an extra slash and making
the path start with "//". This change would break the code if there is ever a
case when "FilePath.normalise cleandir" is missing a significant leading slash.
But could that ever happen? dir (or cleandir) has just passed the "is_absolute"
test.

I hope this is useful.

Best regards

Steve
msg6755 (view) Author: thorkilnaur Date: 2008-11-29.09:35:39
Hello Steve,

Thanks for looking into this in detail and for providing a suggested repair. To be 
even more valuable, if you were able to provide your suggestion as an actual 
patch, perhaps starting with a test case, that would be really nice. There are 
some useful hints on the darcs Wiki, http://wiki.darcs.net/DarcsWiki/DeveloperGettingStarted is perhaps the best place 
to start.

As for your actual suggestion, I believe that others have been doing things 
related to file paths recently, and they may be able to respond. In any case, 
submitting a patch is quite likely to get additional attention.

Thanks again and best regards
Thorkil
msg8723 (view) Author: kowey Date: 2009-09-06.21:01:32
Hi Salvatore (or Steve!), 

This is just a courtesy poke as I make my maintenance rounds around the bug
tracker.  Are you still working on this?

(It sounds like we need a test case first)
msg8836 (view) Author: kirby Date: 2009-09-17.14:22:59
This bug is still open as darcs 2.3. Fixing it is not really easy, as
there're a lot of special cases with network paths (e.g. \\xxx\yyy).
I'll try to look at it again very soon.

Salvatore
msg22368 (view) Author: bfrk Date: 2020-08-01.23:18:29
Set to resolved since the test extended to check for this issue (see 
patch2081) succeeds.
History
Date User Action Args
2008-11-24 11:13:04steve.gardnercreate
2008-11-24 16:05:53thorkilnaursetstatus: unread -> needs-reproduction
nosy: + wglozer, eivuokko, jaredj
topic: + Windows
messages: + msg6738
2008-11-28 13:23:53steve.gardnersetnosy: kowey, wglozer, eivuokko, dagit, simon, thorkilnaur, jaredj, dmitry.kurochkin, steve.gardner
messages: + msg6754
2008-11-29 09:35:43thorkilnaursetnosy: kowey, wglozer, eivuokko, dagit, simon, thorkilnaur, jaredj, dmitry.kurochkin, steve.gardner
messages: + msg6755
2009-03-03 08:22:31kirbysetstatus: needs-reproduction -> has-patch
nosy: + kirby
assignedto: kirby
2009-08-10 23:52:12adminsetnosy: - dagit
2009-08-25 17:35:02adminsetnosy: + darcs-devel, - simon
2009-08-27 14:15:52adminsetnosy: kowey, wglozer, darcs-devel, eivuokko, thorkilnaur, jaredj, dmitry.kurochkin, kirby, steve.gardner
2009-09-06 21:01:38koweysettopic: + FilePath
nosy: kowey, wglozer, darcs-devel, eivuokko, thorkilnaur, jaredj, dmitry.kurochkin, kirby, steve.gardner
messages: + msg8723
2009-09-17 14:23:01kirbysetnosy: kowey, wglozer, darcs-devel, eivuokko, thorkilnaur, jaredj, dmitry.kurochkin, kirby, steve.gardner
messages: + msg8836
2020-08-01 23:12:22bfrksetstatus: has-patch -> resolved
2020-08-01 23:18:31bfrksetstatus: resolved -> unknown
messages: + msg22368