
Hello Café, When I was trying to cabal-install haskell-src, I came up with: cabal: The program happy is required but it could not be found However, the happy package was actually installed and the 'happy' executable was in ~/.cabal/bin (which was in my PATH) I had to link ~/.cabal/bin/happy to /usr/bin/happy so that cabal-install may finally find it.

Am Samstag 01 Mai 2010 13:16:55 schrieb Limestraël:
Hello Café,
When I was trying to cabal-install haskell-src, I came up with: cabal: The program happy is required but it could not be found
However, the happy package was actually installed and the 'happy' executable was in ~/.cabal/bin (which was in my PATH)
Just a couple of days ago, we had an issue where "~/.cabal/bin" was in the path, but (due to some differences between tilde-expansion and $-variable expansion), it didn't work, however "$HOME/.cabal/bin" in the path worked. Could that be another instance of the same issue?

Yes, it's weird, but it works! Thanks.
2010/5/1 Daniel Fischer
Am Samstag 01 Mai 2010 13:16:55 schrieb Limestraël:
Hello Café,
When I was trying to cabal-install haskell-src, I came up with: cabal: The program happy is required but it could not be found
However, the happy package was actually installed and the 'happy' executable was in ~/.cabal/bin (which was in my PATH)
Just a couple of days ago, we had an issue where "~/.cabal/bin" was in the path, but (due to some differences between tilde-expansion and $-variable expansion), it didn't work, however "$HOME/.cabal/bin" in the path worked. Could that be another instance of the same issue?

On May 2, 2010, at 05:33 , Limestraël wrote:
Yes, it's weird, but it works! Thanks.
It's normal, actually. "~" is only understood by the shell, so unless the shell is invoked to expand it a program will fail to understand it. Additionally, some shells only expand "~" at the beginning of a "word", so if you `export PATH=~/foo:~/bar' the second "~" won't be expanded. (bash will expand it after a colon, so that should work.) If you quote the string, "~" won't be expanded (`export PATH="~/foo"' won't expand the "~"). A way to check this: type `env PATH'. If the result contains a "~", you need to look at how you're setting PATH to make sure "~" isn't being quoted. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Am Sonntag 02 Mai 2010 22:26:43 schrieb Brandon S. Allbery KF8NH:
On May 2, 2010, at 05:33 , Limestraël wrote:
Yes, it's weird, but it works! Thanks.
It's normal, actually. "~" is only understood by the shell, so unless the shell is invoked to expand it a program will fail to understand it.
If the default shell is bash and the PATH is set and exported in ~/.bashrc, it should work with '~' unless the string is quoted, shouldn't it? bash expands the tildes when the value is assigned to PATH, I think. That would explain why it's a relatively rare breakage.
Additionally, some shells only expand "~" at the beginning of a "word", so if you `export PATH=~/foo:~/bar' the second "~" won't be expanded. (bash will expand it after a colon, so that should work.)
Do you perchance know which shells would expand only the first tilde?
If you quote the string, "~" won't be expanded (`export PATH="~/foo"' won't expand the "~").
A way to check this: type `env PATH'.
Shouldn't that be echo $PATH or env | grep --regexp $PATH ?
If the result contains a "~", you need to look at how you're setting PATH to make sure "~" isn't being quoted.
If the result contains a tilde, you're already hosed because System.Directory.findExecutable doesn't do tilde-expansion before calling doesFileExist.

Daniel Fischer
Am Sonntag 02 Mai 2010 22:26:43 schrieb Brandon S. Allbery KF8NH:
On May 2, 2010, at 05:33 , Limestraël wrote:
Yes, it's weird, but it works! Thanks.
It's normal, actually. "~" is only understood by the shell, so unless the shell is invoked to expand it a program will fail to understand it.
If the default shell is bash and the PATH is set and exported in ~/.bashrc, it should work with '~' unless the string is quoted, shouldn't it? bash expands the tildes when the value is assigned to PATH, I think. That would explain why it's a relatively rare breakage.
bash expands it when you use it within bash, but when it's used within another program this might not be the case (since the PATH is just a String after all). -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

Am Montag 03 Mai 2010 00:28:31 schrieb Ivan Lazar Miljenovic:
Daniel Fischer
writes: If the default shell is bash and the PATH is set and exported in ~/.bashrc, it should work with '~' unless the string is quoted, shouldn't it? bash expands the tildes when the value is assigned to PATH, I think. That would explain why it's a relatively rare breakage.
bash expands it when you use it within bash, but when it's used within another program this might not be the case (since the PATH is just a String after all).
But does that string contain any '~'s? I think not (unless quoted). I believe the string that is assigned to PATH is already expanded (if you have export PATH=~/.cabal/bin:$PATH in your .bashrc and the right hand side weren't expanded, you'd be in serious difficulties - it is not unthinkable that $PATH is expanded, but not the tilde, but that would be pretty odd).

On 3 May 2010 08:49, Daniel Fischer
Am Montag 03 Mai 2010 00:28:31 schrieb Ivan Lazar Miljenovic:
bash expands it when you use it within bash, but when it's used within another program this might not be the case (since the PATH is just a String after all).
But does that string contain any '~'s? I think not (unless quoted). I believe the string that is assigned to PATH is already expanded (if you have
I tried it: ivanm@feitpc02 ~ $echo $PATH ~/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/home/ivanm/ghc/bin/:/usr/bin/:/home/ivanm/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/home/ivanm/ghc/bin/:/usr/bin/:/home/ivanm/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/usr/bin/:/home/ivanm/ghc/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games ivanm@feitpc02 ~ $ghc -e 'System.Environment.getEnv "PATH"' "~/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/home/ivanm/ghc/bin/:/usr/bin/:/home/ivanm/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/home/ivanm/ghc/bin/:/usr/bin/:/home/ivanm/tools/bin/:/home/ivanm/emacs/bin/:/home/ivanm/.cabal/bin/:/usr/bin/:/home/ivanm/ghc/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" whilst variables might get expanded, ~ isn't. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

On Montag 03 Mai 2010 02:12:20, Ivan Miljenovic wrote:
On 3 May 2010 08:49, Daniel Fischer
wrote: Am Montag 03 Mai 2010 00:28:31 schrieb Ivan Lazar Miljenovic:
bash expands it when you use it within bash, but when it's used within another program this might not be the case (since the PATH is just a String after all).
But does that string contain any '~'s? I think not (unless quoted). I believe the string that is assigned to PATH is already expanded (if you have
I tried it: <snip>
whilst variables might get expanded, ~ isn't.
It is by my bash: dafis@linux-mkk1:~/Haskell> export DUMMY=~/bin:~/.cabal dafis@linux-mkk1:~/Haskell> echo $DUMMY /home/dafis/bin:/home/dafis/.cabal dafis@linux-mkk1:~/Haskell> printenv DUMMY /home/dafis/bin:/home/dafis/.cabal dafis@linux-mkk1:~/Haskell> ghc -e 'System.Environment.getEnv "DUMMY"' "/home/dafis/bin:/home/dafis/.cabal" dafis@linux-mkk1:~/Haskell> bash --version GNU bash, version 3.2.39(1)-release (i586-suse-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc. Apparently, it's version-dependent (unsurprisingly). What's your shell?

On 3 May 2010 10:25, Daniel Fischer
It is by my bash:
dafis@linux-mkk1:~/Haskell> export DUMMY=~/bin:~/.cabal dafis@linux-mkk1:~/Haskell> echo $DUMMY /home/dafis/bin:/home/dafis/.cabal dafis@linux-mkk1:~/Haskell> printenv DUMMY /home/dafis/bin:/home/dafis/.cabal dafis@linux-mkk1:~/Haskell> ghc -e 'System.Environment.getEnv "DUMMY"' "/home/dafis/bin:/home/dafis/.cabal" dafis@linux-mkk1:~/Haskell> bash --version GNU bash, version 3.2.39(1)-release (i586-suse-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc.
Apparently, it's version-dependent (unsurprisingly). What's your shell?
This is on my ubuntu box at uni: ivanm@feitpc02 ~ $export DUMMY="~/bin:~/cabal" ivanm@feitpc02 ~ $echo $DUMMY ~/bin:~/cabal ivanm@feitpc02 ~ $printenv DUMMY ~/bin:~/cabal ivanm@feitpc02 ~ $bash --version GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc. ivanm@feitpc02 ~ $ So yeah, looks like it's version-specific. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

On May 2, 2010, at 20:34 , Ivan Miljenovic wrote:
ivanm@feitpc02 ~ $export DUMMY="~/bin:~/cabal"
All bets are off when it's quoted; no shell tilde-expands quoted strings. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 3 May 2010 10:37, Brandon S. Allbery KF8NH
On May 2, 2010, at 20:34 , Ivan Miljenovic wrote:
ivanm@feitpc02 ~ $export DUMMY="~/bin:~/cabal"
All bets are off when it's quoted; no shell tilde-expands quoted strings.
Oh, in that case without the quotes it works (I thought it had to be quoted for some reason... >_>). Anyway, this looks like what's causing Limestraël's problem then. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

On Montag 03 Mai 2010 02:34:51, Ivan Miljenovic wrote:
This is on my ubuntu box at uni:
ivanm@feitpc02 ~ $export DUMMY="~/bin:~/cabal"
You put quotes around the string, that means tildes aren't expanded ($VARIABLEs still are: dafis@linux-mkk1:~/Haskell> export DUMMY="~/bin:~/.cabal:$HOME/.cabal/bin" dafis@linux-mkk1:~/Haskell> echo $DUMMY ~/bin:~/.cabal:/home/dafis/.cabal/bin). What does it say if you remove the quotes?

On May 2, 2010, at 18:21 , Daniel Fischer wrote:
Additionally, some shells only expand "~" at the beginning of a "word", so if you `export PATH=~/foo:~/bar' the second "~" won't be expanded. (bash will expand it after a colon, so that should work.)
Do you perchance know which shells would expand only the first tilde?
Older zsh when MAGIC_EQUAL_SUBST isn't set. zsh 4.x handles "export" and some other builtins automatically, but MAGIC_EQUAL_SUBST is still needed in some cases, such as the occasionally suggested `echo PATH=... >>.profile'.
A way to check this: type `env PATH'.
Shouldn't that be
It was supposed to be "printenv". *sigh*
If the result contains a "~", you need to look at how you're setting PATH to make sure "~" isn't being quoted.
If the result contains a tilde, you're already hosed because System.Directory.findExecutable doesn't do tilde-expansion before calling doesFileExist.
Er, that's the point. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (5)
-
Brandon S. Allbery KF8NH
-
Daniel Fischer
-
Ivan Lazar Miljenovic
-
Ivan Miljenovic
-
Limestraël