darcs

Issue 1545 account for missing PATH when calling other software

Title account for missing PATH when calling other software
Priority feature Status needs-implementation
Milestone Resolved in
Superseder Nosy List attila.lendvai, darcs-devel, dmitry.kurochkin, jaredj, kowey, thorkilnaur
Assigned To
Topics ProbablyEasy, UI

Created on 2009-08-19.13:59:10 by attila.lendvai, last changed 2012-04-12.07:09:04 by ajsk.

Messages
msg8295 (view) Author: attila.lendvai Date: 2009-08-19.13:59:08
i've set up darcsweb using darcs 2.3.0 and the cgi module of lighttpd. when i
click on a commitdiff link then darcs is invoked so that it (or one of its
dependencies) calls getEnv (instead of getEnvironment) which throws an exception
if $PATH is not set. the error message is this:

darcs: PATH: getEnv: does not exist (no environment variable)

any words on this? thanks in advance!
msg8346 (view) Author: kowey Date: 2009-08-22.11:58:49
Atilla: thanks for the report!  Is there any way could could convince darcsweb
to log the darcs commands it's executing?  What happens when you click on that
commitdiff link?

Darcs developers: when I grepped the darcs source looking for PATH, I got
nothing which indicates that darcs ever directly looks for this.

% grep -r PATH src 
src/best_practices.tex:It can cause surprises if you have a ``wrong'' darcs in
your PATH.
src/Darcs/Commands/Push.lhs:ssh login@remote.machine 'echo $PATH'
src/Darcs/Resolution.lhs:you should make sure the command is in your \verb!PATH!. 
src/Darcs/Utils.hs: "found in your PATH, emacs, emacs -nw, nano and (on Windows)
edit are",
msg8941 (view) Author: attila.lendvai Date: 2009-10-09.18:16:29
i don't know what darcsweb issues, but it's very easy to reproduce this:

$ darcs --version
2.3.1 (release)
$ unset PATH
$ ~/bin/darcs diff
darcs: PATH: getEnv: does not exist (no environment variable)
msg8942 (view) Author: attila.lendvai Date: 2009-10-09.21:20:30
fyi, i had to add "PATH=/usr/bin" for the environment when we invoke darcsweb
with our home-grown cgi engine.

i think this happens because darcs invokes the diff executable from the path,
which is a bit surprising... it should at least emit a useful error message
along the line of "hey, i need to exec diff and i cannot find it in the PATH!"

other than that, now everything works here.
msg8945 (view) Author: kowey Date: 2009-10-10.21:23:53
Thanks to this follow-up I was able to do a tiny bit of digging through the
Darcs code, I can reproduce the problem with a tiny Haskell program:

-- blows up if you unset PATH
import System.Directory
main = findExecutable "diff"

The good news is that you can catch the exception that findExecutable throws.

Looks like some fairly straightforward improvements to add to Darcs.External
msg15557 (view) Author: ajsk Date: 2012-04-12.07:09:03
Any new news on this bug? 
Perhaps it may be wiser to use a default path if there is none available
as a fix?
That would be very simple to implement, and could be done per-platform.
A worse case could use the path of the darcs executable.
History
Date User Action Args
2009-08-19 13:59:10attila.lendvaicreate
2009-08-21 21:00:58koweysetstatus: unknown
nosy: kowey, attila.lendvai, simon, thorkilnaur, dmitry.kurochkin
2009-08-22 11:58:52koweysetstatus: unknown -> waiting-for
nosy: kowey, attila.lendvai, simon, thorkilnaur, dmitry.kurochkin
messages: + msg8346
assignedto: attila.lendvai
2009-08-25 18:15:47adminsetnosy: + darcs-devel, - simon
2009-08-27 14:29:23adminsetnosy: kowey, darcs-devel, attila.lendvai, thorkilnaur, dmitry.kurochkin
2009-10-09 18:16:31attila.lendvaisetnosy: kowey, darcs-devel, attila.lendvai, thorkilnaur, dmitry.kurochkin
messages: + msg8941
2009-10-09 21:20:33attila.lendvaisetnosy: kowey, darcs-devel, attila.lendvai, thorkilnaur, dmitry.kurochkin
messages: + msg8942
2009-10-10 21:23:59koweysetstatus: waiting-for -> needs-implementation
topic: + ProbablyEasy, UI
title: something calls getEnv for $PATH, but it throws if it does not exist -> account for missing PATH when calling other software
nosy: + jaredj
messages: + msg8945
priority: bug -> feature
assignedto: attila.lendvai ->
2009-10-23 22:34:56adminsetnosy: + attila_lendvai, - attila.lendvai
2009-10-23 23:48:55adminsetnosy: + attila.lendvai, - attila_lendvai
2012-04-12 07:09:04ajsksetmessages: + msg15557