Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5754 closed bug (invalid)

Cabal cannot register a package in a directory with Unicode chars

Reported by: simonmar Owned by: simonmar
Priority: highest Milestone: 7.4.1
Component: Package system Version: 7.2.1
Keywords: Cc: duncan
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #3977 Differential Rev(s):
Wiki Page:

Description

While fixing #5697, I tried building and registering a package in a directory with Unicode chars, and cabal-install fails to register it.

This appears to be a regression since 7.0, as it first fails with 7.2 and is still failing in 7.4.

I'm not sure who's fault this is, but since it is GHC-version dependent it could well be ours.

c:\simonmar\scratch\áéóíúúíáλ>cabal register --inplace -v
c:\simonmar\ghc-validate\inplace\bin\ghc-stage2.exe --abi-hash -package-name par
allel-3.2.0.0 -hide-all-packages -fbuilding-cabal-package -i -idist\build -i. -i
dist\build\autogen -Idist\build\autogen -Idist\build -optP-include -optPdist\bui
ld\autogen\cabal_macros.h -odir dist\build -hidir dist\build -stubdir dist\build
 -package-id array-0.3.0.3-inplace -package-id base-4.4.0.0-inplace -package-id
containers-0.4.2.0-inplace -package-id deepseq-1.2.0.1-inplace -O -feager-blackh
oling -Wall -XCPP -XBangPatterns Control.Seq Control.Parallel Control.Parallel.S
trategies
Registering parallel-3.2.0.0...
c:\simonmar\ghc-validate\inplace\bin\ghc-pkg.exe update - --global --user
cabal: fd:5: hGetContents: invalid argument (invalid UTF-8 byte sequence)
cabal: fd:5: invalid argument

I tried with cabal-install 0.8 and 0.10:

c:\simonmar\scratch\áéóíúúíáλ>cabal --version
cabal-install version 0.10.2
using version 1.10.2.0 of the Cabal library

c:\simonmar\scratch\áéóíúúíáλ>cabal +RTS --info
 [("GHC RTS", "YES")
 ,("GHC version", "7.0.4")
 ,("RTS way", "rts_v")
 ,("Build platform", "i386-unknown-mingw32")
 ,("Build architecture", "i386")
 ,("Build OS", "mingw32")
 ,("Build vendor", "unknown")
 ,("Host platform", "i386-unknown-mingw32")
 ,("Host architecture", "i386")
 ,("Host OS", "mingw32")
 ,("Host vendor", "unknown")
 ,("Target platform", "i386-unknown-mingw32")
 ,("Target architecture", "i386")
 ,("Target OS", "mingw32")
 ,("Target vendor", "unknown")
 ,("Word size", "32")
 ,("Compiler unregisterised", "NO")
 ,("Tables next to code", "YES")
 ]

I haven't tried building cabal-install with 7.2 yet.

Change History (7)

comment:1 Changed 8 years ago by simonmar

Operating System: Unknown/MultipleWindows

Should have mentioned this is on Windows.

comment:2 Changed 8 years ago by simonpj

Owner: set to simonmar

comment:3 Changed 8 years ago by marlowsd@…

commit 81c69f305c79c181a2e15cf88615baa441dae755

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Fri Jan 6 14:51:40 2012 +0000

    Make the RTS linker API use wide-char pathnames on Windows (#5697)
    
    I haven't been able to test whether this works or not due to #5754,
    but at least it doesn't appear to break anything.

 compiler/ghci/ObjLink.lhs |   38 ++++---------
 includes/rts/Linker.h     |   18 ++++--
 rts/Linker.c              |  136 +++++++++++++++++++++++++++-----------------
 rts/LinkerInternals.h     |    2 +-
 4 files changed, 107 insertions(+), 87 deletions(-)

comment:4 Changed 8 years ago by simonmar

Resolution: invalid
Status: newclosed

I understand a bit more about what is going on here. I removed cabal-install from the equation by using Setup.hs instead. What happens is:

ghc-pkg is trying to emit a warning that the Haddock interface doesn't exist (because I didn't generate it).

ghc-pkg is a subprocess invoked by Cabal, and as such is not attached to the console. It therefore doesn't get the console's code page, and at least on my system it then defaults to CP 850 (I had the console set to CP 65001, i.e. UTF-8). In CP 850 the Unicode chars in the directory cannot be printed, so ghc-pkg fails when trying to print the warning.

Cabal then tries to read the output generated by ghc-pkg, but since Cabal is attached to the console it is using UTF-8 and so misinterprets the output generated by ghc-pkg, leading to more errors.

I don't think there's actually anything wrong here. Why it wasn't failing before I have no idea. To work around it there are several options:

  • Don't create directories containing characters not in the system code page
  • Don't use chcp to set the console code page differently from the system code page
  • Run cabal haddock to generate the right files and stop ghc-pkg complaining

comment:5 Changed 8 years ago by simonmar

There does seem to be a separate bug that manifests on Linux, but it seems to be gone with the latest Cabal. It only happens if I use a cabal built against Cabal-0.10 to build a package with GHC 7.2 or later (or equivalently compile Setup.hs against Cabal-0.10). Then this happens:

> ./Setup build                                
Preprocessing library parallel-3.2.0.0...
Building parallel-3.2.0.0...
Registering parallel-3.2.0.0...
Setup: parallel-3.2.0.0: Warning: library-dirs:
/home/simonmar/scratch/αβγλ/dist/build doesn't exist or isn't a directory
parallel-3.2.0.0: Warning: haddock-interfaces:
/home/simonmar/scratch/αβγλ/dist/doc/html/parallel/parallel.haddock
doesn't exist or isn't a file
parallel-3.2.0.0: Warning: haddock-html:
/home/simonmar/scratch/αβγλ/dist/doc/html/parallel doesn't exist or isn't
a directory
parallel-3.2.0.0: import-dirs: /home/simonmar/scratch/αβγλ/dist/build
doesn't exist or isn't a directory (use --force to override)
parallel-3.2.0.0: file Control/Seq.hi is missing (use --force to override)
parallel-3.2.0.0: file Control/Parallel.hi is missing (use --force to
override)
parallel-3.2.0.0: file Control/Parallel/Strategies.hi is missing (use --force
to override)
parallel-3.2.0.0: cannot find libHSparallel-3.2.0.0.a on library path (use
--force to override)

Since that bug appears to be fixed now, I'm not going to worry about it (but we do need to make sure cabal can be built with 7.2 and later, which currently does not seem to be the case).

comment:6 Changed 8 years ago by shelarcy

comment:7 Changed 8 years ago by shelarcy

Note: See TracTickets for help on using tickets.