On Wed, Aug 25, 2010 at 5:51 PM, Eric Kow <[email protected]> wrote: > > Eric Kow <[email protected]> added the comment: > > Hi Dmitry, many thanks for improving our test suite! It makes bugs > easier to solve. > > About the test: is "0401:19d2" really a minimal example of a filename > with a colon on it? Maybe something simpler take makes fewer > suggestions about what may be the actual problem would be good. Adding > to that, it might also be nice to have *two* examples, one showing the > expected behaviour on colons (c:/foo should be recognised as a windows > path) and the minimal difference which makes Darcs go wrong (cx:/foo > probably should not). >
Yeah, that would be nice. Let's chat a bit first, though. The real issue at hand is with handling "tricky" characters in file names. On Unix, I can have ':' and '?' or '<' in my filename, while on Windows they are forbidden. It seems to me that no attempt is made to handle this characters in some special way anywhere in the darcs, so I guess that the official position is that users are allowed to shoot themselves in the foot however they like. I am fine with that and will assume this much for the rest of the text. So, the correct behavior for darcs would be to add files like "aaa:bbb" and even "c:\src" to the repository, as long as those files really exist and are really files. Now, colon has a special role in Darcs, since it is used in names of remote scp-accessible repositories. It seems that a colon in repository name should automatically mean that it is either a HTTP repo or an scp repo. Unless we make a drastical change and start requiring "scp://" in front of the scp repo names, all colons in repo dir names should be disallowed. Then, functions in Darcs.URL clearly serve to distinguish between possible forms of repo names. * isUrl should be true for names like http://.... * isSsh should be true for all names that are not URLs and containin ':' * isFile should be true whenever both isSSH and isURL are false. I browsed through the source and isFile, isSsh, and isUrl are indeed used to differentiate between possible forms of repository names everywhere, except for the "isRelative" in URL.hs My proposal is: 1)Replace isRelative from URL.hs by isRelative from System.FilePath, which should take into account differences between platforms and handle colon under unix in sensible way. 2)Submit the proposal to mark ssh-accesible repositories by "ssh://" and replace a horrible ad-hoc implementations of isSsh and isFile with much better ad-hoc implementation: isSsh f = "ssh://" `isPrefixOf` f isUrl f = not (isSsh f) && "://" `isInfixOf` f isFile f = not (isSsh f || isUrl f) Do you agree? I'll be submitting the patch for (1) shortly (along with proper test-case). > Some admin stuff: may I ask for a little bit of extra help on your part? > Could you re-submit this patch as a Darcs patch, following the > conventions in http://wiki.darcs.net/Development/RegressionTests ? > Will do. Likewise for licensing. -- Dmitry Astapov
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
