darcs

Patch 1634 Resolve issue2537: Allow / as root directory

Title Resolve issue2537: Allow / as root directory
Superseder Nosy List gpiero
Related Issues
Status in-discussion Assigned To
Milestone

Created on 2018-01-06.12:35:49 by gpiero, last changed 2018-01-19.07:28:00 by gpiero.

Files
File name Status Uploaded Type Edit Remove
resolve-issue2537_-allow-_-as-root-directory.dpatch gpiero, 2018-01-06.12:35:47 application/octet-stream
See mailing list archives for discussion on individual patches.
Messages
msg19818 (view) Author: gpiero Date: 2018-01-06.12:35:47
I don't know how to safely test it via a shell script in tests/, so if
someone
versed in Haskell unit testing could add a test checking something like
makeSubPathOf (AbsolutePath "/") (AbsolutePath "/dir") = Just (SubPath
"dir")
...
Attachments
msg19823 (view) Author: gpiero Date: 2018-01-18.19:01:17
It occurred to me that this patch possibly doesn't work or could even do 
harmful things in Windows, depending on how file paths are represented.
More specifically:

1. if absolute paths are in the form '/<volume>/<path>' (unlikely, I 
think), this patch does evil things(tm), like considering '/D/file' to 
be part of '/C/' repo.

2. if absolute paths are in the form '<volume>:\<path>' and the root of 
a repo created in the top dir of a volume is '<volume>:\', i.e.: 
'C:\file' and 'C:\' respectively, this patch fixes the problem on POSIX 
but the issue still stands on Windows.

3. if absolute paths are in the form '<volume>:\<path>' and the root of 
a repo created in the top dir of a volume is '<volume>:', i.e.: 
'C:\file' and 'C:'(note the lack of slash) respectively, this patch 
fixes the problem on POSIX. The issue was not present on Windows nor 
this patch introduces a regression.

My guess is the right answer is the number 2, but I would be grateful if 
someone could create a repo on the top dir of a volume and let me know 
the content of the 'Root:' line in the output of `darcs show repo`.

Thanks,
Gian Piero.

PS: 'direction' (forward or backward) of the slashes is irrelevant as, 
if I've read correctly the code, all backward slashes are transformed to 
forward ones before comparing the paths.
History
Date User Action Args
2018-01-06 12:35:49gpierocreate
2018-01-18 19:01:18gpierosetmessages: + msg19823
2018-01-19 07:28:00gpierosetstatus: needs-screening -> in-discussion