hoogle command line program on Linux

Hi all, I'm testing out hoogle 4.1.2 on Debian Linux and getting the following when trying to update the local hoogle databases: erik > sudo hoogle data Starting default Starting keyword hoogle: keyword.txt: commitAndReleaseBuffer: invalid argument (Invalid or incomplete multibyte or wide character) My LANG related envorinment variables are set as follows: erik > env | grep LANG LANG=en_AU.UTF-8 GDM_LANG=en_AU.UTF-8 LANGUAGE=en_AU.UTF-8 LC_LANG=en_AU.UTF-8 When faced with a similar problem while working on Ben Lippmeier's compiler, I fixed this by replacing all instances of readFile with readUtf8File which is defined as: readUtf8File :: FilePath -> IO String readUtf8File filePath = do h <- openFile filePath ReadMode hSetEncoding h utf8 hSetEncoding stdout utf8 hGetContents h Is it possible to fix this without hacking the hoogles sources? I'd like to package hoogle for Debian, but first I need to get it working. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

Hi Erik,
I'll release Hoogle 4.1.3 with a fix later today.
Thanks, Neil
On Sun, Jan 9, 2011 at 5:07 AM, Erik de Castro Lopo
Hi all,
I'm testing out hoogle 4.1.2 on Debian Linux and getting the following when trying to update the local hoogle databases:
erik > sudo hoogle data Starting default Starting keyword hoogle: keyword.txt: commitAndReleaseBuffer: invalid argument (Invalid or incomplete multibyte or wide character)
My LANG related envorinment variables are set as follows:
erik > env | grep LANG LANG=en_AU.UTF-8 GDM_LANG=en_AU.UTF-8 LANGUAGE=en_AU.UTF-8 LC_LANG=en_AU.UTF-8
When faced with a similar problem while working on Ben Lippmeier's compiler, I fixed this by replacing all instances of readFile with readUtf8File which is defined as:
readUtf8File :: FilePath -> IO String readUtf8File filePath = do h <- openFile filePath ReadMode hSetEncoding h utf8 hSetEncoding stdout utf8 hGetContents h
Is it possible to fix this without hacking the hoogles sources? I'd like to package hoogle for Debian, but first I need to get it working.
Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi Erik,
Hoogle 4.1.3 is now released, which reads and writes Hoogle input
files in UTF8 throughout. Please let me know if this doesn't fix your
problem.
Thanks, Neil
On Sun, Jan 9, 2011 at 11:22 AM, Neil Mitchell
Hi Erik,
I'll release Hoogle 4.1.3 with a fix later today.
Thanks, Neil
On Sun, Jan 9, 2011 at 5:07 AM, Erik de Castro Lopo
wrote: Hi all,
I'm testing out hoogle 4.1.2 on Debian Linux and getting the following when trying to update the local hoogle databases:
erik > sudo hoogle data Starting default Starting keyword hoogle: keyword.txt: commitAndReleaseBuffer: invalid argument (Invalid or incomplete multibyte or wide character)
My LANG related envorinment variables are set as follows:
erik > env | grep LANG LANG=en_AU.UTF-8 GDM_LANG=en_AU.UTF-8 LANGUAGE=en_AU.UTF-8 LC_LANG=en_AU.UTF-8
When faced with a similar problem while working on Ben Lippmeier's compiler, I fixed this by replacing all instances of readFile with readUtf8File which is defined as:
readUtf8File :: FilePath -> IO String readUtf8File filePath = do h <- openFile filePath ReadMode hSetEncoding h utf8 hSetEncoding stdout utf8 hGetContents h
Is it possible to fix this without hacking the hoogles sources? I'd like to package hoogle for Debian, but first I need to get it working.
Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Neil Mitchell wrote:
Hoogle 4.1.3 is now released, which reads and writes Hoogle input files in UTF8 throughout. Please let me know if this doesn't fix your problem.
Thanks Neil for the quick response. That definitely has fixed thet problem. The next problem is that hoogle installed as a Debian package would install as root as /usr/bin/hoogle. Then, when I run "hoogle data" it wants to install the database at /usr/share/hoogle/hoogle-4.1.3/databases which fails because I'm not running as root. So, to install the databases I need to run "sudo hoogle data" (which is acceptable), but then an unprivelidge user can't run hoogle because they don't have read permission on the database. The solution would be to set the umask before writing the databases. Something like (untested): import System.Posx -- Set umask to world read/execute. Save old umask for -- restoration later. oldumask <- setFileCreationMask 0o022 If you need help with this, let me know. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

Hi Erik,
The next problem is that hoogle installed as a Debian package would install as root as /usr/bin/hoogle. Then, when I run "hoogle data" it wants to install the database at /usr/share/hoogle/hoogle-4.1.3/databases which fails because I'm not running as root. So, to install the databases I need to run "sudo hoogle data" (which is acceptable), but then an unprivelidge user can't run hoogle because they don't have read permission on the database.
The solution would be to set the umask before writing the databases. Something like (untested):
import System.Posx
-- Set umask to world read/execute. Save old umask for -- restoration later. oldumask <- setFileCreationMask 0o022
Should all files created by hoogle data always have world read/execute? I'm not sure what the Unix conventions are - would that be reasonable? If so, I'll make a new release that just changes the file creation mask to the above during hoogle data (and sets it back after). Thanks, Neil

Neil Mitchell wrote:
Should all files created by hoogle data always have world read/execute? I'm not sure what the Unix conventions are - would that be reasonable?
The files created by the 'hoogle data' command in /usr/share/hoogle should probably all be world readable. The directories should all be world readable and world executable (ie allow anyone to chdir into it).
If so, I'll make a new release that just changes the file creation mask to the above during hoogle data (and sets it back after).
That makes sense. If you have a darcs repo of the code (or even a tarball), I can check it before create a package. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

If so, I'll make a new release that just changes the file creation mask to the above during hoogle data (and sets it back after).
That makes sense. If you have a darcs repo of the code (or even a tarball), I can check it before create a package.
That would be very useful. I'll try and update the darcs version tomorrow and let you know when it's done. Thanks, Neil

On Mon, Jan 10, 2011 at 10:17 PM, Neil Mitchell
If so, I'll make a new release that just changes the file creation mask to the above during hoogle data (and sets it back after).
Thanks to Erik's help testing preview versions I've now released Hoogle 4.1.4 that sets the file creation mask appropriately. Thanks, Neil

On 15 January 2011 22:53, Neil Mitchell
On Mon, Jan 10, 2011 at 10:17 PM, Neil Mitchell
wrote: If so, I'll make a new release that just changes the file creation mask to the above during hoogle data (and sets it back after).
Thanks to Erik's help testing preview versions I've now released Hoogle 4.1.4 that sets the file creation mask appropriately.
Shouldn't data like this really go in /var rather than /usr ? To quote Wikipedia [1]: "/var/: Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files." [1]: http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

Thanks to Erik's help testing preview versions I've now released Hoogle 4.1.4 that sets the file creation mask appropriately.
Shouldn't data like this really go in /var rather than /usr ? To quote Wikipedia [1]: "/var/: Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files."
The Hoogle databases are expected to change very rarely - most users will install them when they install Hoogle. A small number will update them occasionally as the packages update. I'm using the Cabal datadir to store the databases, but does Cabal provide a more sensible place to put them? As a Windows user, I'm happy to defer to what Posix system users want. Thanks, Neil

Hi, Am Samstag, den 15.01.2011, 13:38 +0000 schrieb Neil Mitchell:
Thanks to Erik's help testing preview versions I've now released Hoogle 4.1.4 that sets the file creation mask appropriately.
Shouldn't data like this really go in /var rather than /usr ? To quote Wikipedia [1]: "/var/: Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files."
The Hoogle databases are expected to change very rarely - most users will install them when they install Hoogle. A small number will update them occasionally as the packages update. I'm using the Cabal datadir to store the databases, but does Cabal provide a more sensible place to put them? As a Windows user, I'm happy to defer to what Posix system users want.
shouldn’t they change with every library update? In that case, maybe that should be managed by cabal, similar to how cabal can update your haddock index at ~/.cabal/share/doc/index.html. (Such an infrastructure would be nice for other people as well, e.g. leksah). But I might misunderstand how hoogle works and what the databases are for. Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org

Hi Joachim,
The Hoogle databases are expected to change very rarely - most users will install them when they install Hoogle. A small number will update them occasionally as the packages update. I'm using the Cabal datadir to store the databases, but does Cabal provide a more sensible place to put them? As a Windows user, I'm happy to defer to what Posix system users want.
shouldn’t they change with every library update? In that case, maybe that should be managed by cabal, similar to how cabal can update your haddock index at ~/.cabal/share/doc/index.html.
Yes, that's exactly how it should work. All we need is someone to do the work :-) There is a bug tracking the progress on this issue here: http://code.google.com/p/ndmitchell/issues/detail?id=80 - but its a reasonable amount of work, touching lots of different parts of the Haskell infra. Thanks, Neil
participants (4)
-
Erik de Castro Lopo
-
Ivan Lazar Miljenovic
-
Joachim Breitner
-
Neil Mitchell