darcs

Issue 2516 Invalid URI error when cloning repo with darcs on windows without curl

Title Invalid URI error when cloning repo with darcs on windows without curl
Priority Status given-up
Milestone Resolved in
Superseder Nosy List mihaigiurgeanu
Assigned To
Topics

Created on 2016-11-16.14:09:02 by mihaigiurgeanu, last changed 2017-07-31.02:19:04 by gh.

Messages
msg19317 (view) Author: mihaigiurgeanu Date: 2016-11-16.14:09:00
Darcs fails with error 'Invalid URI' when cloning remote repo with darcs 
2.12.4 compiled on windows without curl lib (`stack install darcs --flag 
darcs:-curl`):


    D:\Projects>darcs clone http://hub.darcs.net/AriePeterson/console-
program

    darcs failed:  Invalid URI: 
http://hub.darcs.net/AriePeterson/console-
program\_darcs\hashed_inventory

The exact version of darcs is:

darcs compiled on Nov 15 2016, at 12:20:28

Context:

[TAG 2.12.4
Guillaume Hoffmann <guillaumh@gmail.com>**20160914143914
 Ignore-this: fee5b93a45e3a175e63e6fdb837ec4dc
]

Compiled with:

HTTP-4000.3.3
Win32-2.3.1.1
array-0.5.1.1
async-2.1.0
attoparsec-0.13.1.0
base-4.9.0.0
base16-bytestring-0.1.1.6
binary-0.8.3.0
bytestring-0.10.8.1
containers-0.5.7.1
cryptohash-0.11.9
data-ordlist-0.4.7.0
directory-1.2.6.2
fgl-5.5.3.0
filepath-1.4.1.0
graphviz-2999.18.1.2
hashable-1.2.4.0
haskeline-0.7.2.3
html-1.0.1.2
mmap-0.5.9
mtl-2.2.1
network-2.6.3.1
network-uri-2.6.1.0
old-time-1.1.0.3
parsec-3.1.11
process-1.4.2.0
random-1.1
regex-applicative-0.3.3
regex-compat-tdfa-0.95.1.4
sandi-0.4.0
tar-0.5.0.3
text-1.2.2.1
time-1.6.0.1
transformers-0.5.2.0
transformers-compat-0.5.1.4
unix-compat-0.4.2.0
utf8-string-1.0.1.1
vector-0.11.0.0
zip-archive-0.3.0.5
zlib-0.6.1.2

The operating system: Window 7 Professional, 64 bit
msg19318 (view) Author: mihaigiurgeanu Date: 2016-11-16.14:40:37
darcs 2.10.3 works well. The exact working version is:

darcs compiled on Nov 16 2016, at 17:15:31

Context:

[TAG 2.10.3
Guillaume Hoffmann <guillaumh@gmail.com>**20160129115730
 Ignore-this: 7eac9bf53015a285c43e6ea2b1e11a1d
]

Compiled with:

HTTP-4000.3.3
Win32-2.3.1.0
array-0.5.1.0
attoparsec-0.13.1.0
base-4.8.2.0
base16-bytestring-0.1.1.6
binary-0.7.5.0
bytestring-0.10.6.0
containers-0.5.6.2
cryptohash-0.11.9
data-ordlist-0.4.7.0
directory-1.2.2.0
filepath-1.4.0.0
hashable-1.2.4.0
haskeline-0.7.2.3
html-1.0.1.2
mmap-0.5.9
mtl-2.2.1
network-2.6.3.1
network-uri-2.6.1.0
old-time-1.1.0.3
parsec-3.1.11
process-1.2.3.0
random-1.1
regex-applicative-0.3.3
regex-compat-tdfa-0.95.1.4
sandi-0.3.6
tar-0.5.0.3
text-1.2.2.1
time-1.5.0.1
transformers-0.4.2.0
transformers-compat-0.4.0.4
unix-compat-0.4.1.4
utf8-string-1.0.1.1
vector-0.11.0.0
zip-archive-0.2.3.7
zlib-0.6.1.2
msg19323 (view) Author: gh Date: 2016-11-21.16:32:22
Hi Mihai,

thanks for the report; we'll try to look into it soon.

It may be related with the following changes in the 2.14 branch:

*
http://hub.darcs.net/darcs/darcs-2.12/patch/c0439f3febf6594426189cd7173944e5ad15d2b6
  "resolve issue2498: unconditionally use the Haskell HTTP package"

*
http://hub.darcs.net/darcs/darcs-2.12/patch/7cc493ec9cab956f45512143651200de1f6d09d4
  "require GHC 7.10 and time 1.5"
msg19324 (view) Author: mihaigiurgeanu Date: 2016-11-23.07:59:06
Hi Guillaume,

I checked a little bit and I am almost sure that the problem was introduced by the patch http://hub.darcs.net/darcs/darcs-
2.12/patch/109a5667e7cf1f4db879a2aa4076237229f90b09

This patch refactored some things about Darcs.Repository module. One of the things was, I quote, "consistent use of the </> operator from 
System.FilePath". The use of </> operator was extended to building url paths, which, in my opinion is not correct, since the url paths do not depend on 
the platform and local file system as I understand the </> operator does.

The previous code in Darcs.Repository,

    -copyBasicRepoPacked ::
    -  forall p wR wU wT. (RepoPatch p, ApplyState (PrimOf p) ~ Tree, ApplyState p ~ Tree)
    -  => Repository p wR wU wT
    -  -> Verbosity -> UseCache
    -  -> UMask -> RemoteDarcs
    -  -> WithWorkingDir
    -  -> IO ()
    -copyBasicRepoPacked r@(Repo fromDir _ _ _) verb useCache umask rdarcs withWorkingDir =
    -  do let hashURL = fromDir ++ packsDir ++ "pristine"
    -     mPackHash <- (Just <$> gzFetchFilePS hashURL Uncachable) `catchall` (return Nothing)
    -     let hiURL = fromDir ++ "/" ++ darcsdir ++ "/hashed_inventory"
    -     i <- gzFetchFilePS hiURL Uncachable
    -     let currentHash = BS.pack $ inv2pris i
    -     let copyNormally = copyBasicRepoNotPacked r verb useCache umask rdarcs withWorkingDir
    -     case mPackHash of
    -      Just packHash | packHash == currentHash
    -              -> ( copyBasicRepoPacked2 r verb useCache withWorkingDir
    -                    `catchall` do putStrLn "Problem while copying basic pack, copying normally."
    -                                  copyNormally)
    -      _       -> do putVerbose verb $ text "Remote repo has no basic pack or outdated basic pack, copying normally."
    -                    copyNormally

was replaced with the new code in Darcs.Repository.Clone:

    301:                           | copyBasicRepoPacked ::
    302:      ganesh@earth.li  #13 |   forall rt p wR wU wT. (IsRepoType rt, RepoPatch p, ApplyState (PrimOf p) ~ Tree, ApplyState p ~ Tree)
    303:      ganesh@earth.li  #17 |   => Repository rt p wR wU wT -- remote
    304:                           |   -> Repository rt p wR wU wT -- existing empty local repository
    305:  guillaumh@gmail.com   #3 |   -> Verbosity
    306:                           |   -> RemoteDarcs
    307: benjamin.franksen@he   #2 |   -> WithWorkingDir
    308:                           |   -> IO ()
    309:  guillaumh@gmail.com   #3 | copyBasicRepoPacked r@(Repo fromDir _ _ _) toRepo verb rdarcs withWorkingDir =
    310: benjamin.franksen@he   #2 |   do let hashURL = fromDir </> darcsdir </> packsDir </> "pristine"
    311:                           |      mPackHash <- (Just <$> gzFetchFilePS hashURL Uncachable) `catchall` (return Nothing)
    312:                           |      let hiURL = fromDir </> darcsdir </> "hashed_inventory"
    313:                           |      i <- gzFetchFilePS hiURL Uncachable
    314:                           |      let currentHash = BS.pack $ inv2pris i
    315:  guillaumh@gmail.com   #3 |      let copyNormally = copyBasicRepoNotPacked r toRepo verb rdarcs withWorkingDir
    316: benjamin.franksen@he   #2 |      case mPackHash of
    317:                           |       Just packHash | packHash == currentHash
    318:  guillaumh@gmail.com   #3 |               -> ( copyBasicRepoPacked2 r toRepo verb withWorkingDir
    319:                           |                     `catch` \(e :: SomeException) ->
    320:                           |                                do putStrLn ("Exception while getting basic pack:\n" ++ show e)
    321: benjamin.franksen@he   #2 |                                   copyNormally)
    322:                           |       _       -> do putVerbose verb $ text "Remote repo has no basic pack or outdated basic pack, copying normally."
    323:                           |                     copyNormally
    324:                           |


Please note that, in the previous version (one that works with Windows too), the URL was constructed using "/", but in the latest version, the url is 
constrtucted using System.FilePath </> operator.
msg19325 (view) Author: bfrk Date: 2016-12-20.19:48:18
Sorry my fault. Will try to fix.
msg19327 (view) Author: bfrk Date: 2016-12-20.20:34:14
I have pushed a patch that should fix this. Can you try again with a
freshly compiled darcs (http://darcs.net/screened)?
History
Date User Action Args
2016-11-16 14:09:02mihaigiurgeanucreate
2016-11-16 14:40:38mihaigiurgeanusetmessages: + msg19318
2016-11-21 16:32:24ghsetmessages: + msg19323
2016-11-23 07:59:08mihaigiurgeanusetmessages: + msg19324
2016-12-20 19:48:21bfrksetmessages: + msg19325
2016-12-20 20:34:15bfrksetstatus: unknown -> has-patch
messages: + msg19327
2017-07-31 02:19:04ghsetstatus: has-patch -> given-up