#4480: System.Directory.canonicalizePath gives bad result
------------------------------------------+---------------------------------
  Reporter:  erikd                        |          Owner:                  
      Type:  bug                          |         Status:  new             
  Priority:  normal                       |      Milestone:                  
 Component:  libraries/directory          |        Version:  7.1             
Resolution:                               |       Keywords:                  
  Testcase:                               |      Blockedby:                  
Difficulty:                               |             Os:  Windows         
  Blocking:                               |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  |  
------------------------------------------+---------------------------------
Description changed by igloo:

Old description:

> Running ghci on linux with an empty path gives different wrong results
> each time:
>
>    Prelude> System.Directory.canonicalizePath []
>    "\153\229\228]\170\DEL"
>    Prelude> System.Directory.canonicalizePath []
>    "\160\147\155\\\170\DEL"
>    Prelude> System.Directory.canonicalizePath []
>    "\136"
>
> As pointed out by geheimdienst on #haskell:
>
>     my speculation is this: canonicalizePath calls realpath, which
>     for "" gives an EINVAL with the result string being undefined.
>     haskell forgets to check errno and takes the undefined string
>
> This bug exists on 6.12.1 on Debian and 6.12.3 on FreeBSD.

New description:

 Running ghci on linux with an empty path gives different wrong results
 each time:
 {{{
    Prelude> System.Directory.canonicalizePath []
    "\153\229\228]\170\DEL"
    Prelude> System.Directory.canonicalizePath []
    "\160\147\155\\\170\DEL"
    Prelude> System.Directory.canonicalizePath []
    "\136"
 }}}
 As pointed out by geheimdienst on #haskell:

     my speculation is this: canonicalizePath calls realpath, which
     for "" gives an EINVAL with the result string being undefined.
     haskell forgets to check errno and takes the undefined string

 This bug exists on 6.12.1 on Debian and 6.12.3 on FreeBSD.

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4480#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to