Bug#392604: mldonkey-server: mldonkey_server requires that HOME is set but claims the contrary
Package: mldonkey-server
Version: 2.8.1-1
Severity: normal
Tags: patch
mldonkey_server cannot run if the HOME variable is unset, whether the
--chdir option is used or not:
# mldonkey_server
Set niceness of the process: 0
Set uid/gid of the process (0, 0)
Set umask of the process: 18
Chdir to home dir: /root
Writing PID (5432) to pidfile: /root/.mldonkey/mldonkey.pid
Launching MLnet process
2006/10/12 09:01:35 [cO] Starting MLDonkey 2.8.1 ...
2006/10/12 09:01:35 [cO] Language EN, locale UTF-8, ulimit for open
files 1024
2006/10/12 09:01:35 [cO] MLDonkey is working in .
2006/10/12 09:01:35 Loading language resource
/root/.mldonkey/mlnet_strings.en_US.UTF-8
2006/10/12 09:01:35 [cO] loaded language resource file
2006/10/12 09:01:35 [DNS] Resolving [maillekeul] ...
2006/10/12 09:01:35 [DNS] Resolving [www.mldonkey.net] ...
2006/10/12 09:01:35 [cO] Logging in ./mlnet.log
2006/10/12 09:01:35 [dMain] Core started
Terminate process
Stopping processes PID ( 5433 0 0 )
Waiting termination of process 5433
Process 5433 terminated
Process stopped PID ( 5433 0 0 )
MLDonkey server end
Removing pidfile: /root/.mldonkey/mldonkey.pid
# unset HOME
# mldonkey_server
Could not guess $HOME environnement variable: provide a --chdir or
$HOME
# mldonkey_server --chdir /root/.mldonkey
Set niceness of the process: 0
Set uid/gid of the process (0, 0)
Set umask of the process: 18
Could not guess $HOME environnement variable: provide a --chdir or
$HOME
# HOME=/nonexistent mldonkey_server --chdir /root/.mldonkey
Set niceness of the process: 0
Set uid/gid of the process (0, 0)
Set umask of the process: 18
Chdir to home dir: /nonexistent
Writing PID (5438) to pidfile: /root/.mldonkey/mldonkey.pid
Launching MLnet process
2006/10/12 09:04:06 [cO] Starting MLDonkey 2.8.1 ...
2006/10/12 09:04:06 [cO] Language EN, locale UTF-8, ulimit for open
files 1024
2006/10/12 09:04:06 [cO] MLDonkey is working in .
2006/10/12 09:04:06 Loading language resource
/root/.mldonkey/mlnet_strings.en_US.UTF-8
2006/10/12 09:04:06 [cO] loaded language resource file
2006/10/12 09:04:06 [DNS] Resolving [maillekeul] ...
2006/10/12 09:04:06 [DNS] Resolving [www.mldonkey.net] ...
2006/10/12 09:04:06 [cO] Logging in ./mlnet.log
2006/10/12 09:04:06 [dMain] Core started
mldonkey_server claims that a --chdir option can replace a HOME
variable, but it cannot run if HOME is unset.
I do not understand the necessity of the following 2 lines in the
definition of the go_home function (around the line 280):
debug st ("Chdir to home dir: " ^ (user_home st));
Unix.putenv "HOME" (user_home st);
Why display "Chdir to home" when we chdir to chdir? It could be
necessary to set HOME if mlnet required a defined HOME variable; is it
the case? Or is it very unconventional to not have a HOME variable? I
tested the program without those lines and it works fine, so here is the
patch:
--- debian/utils/mldonkey_server.ml.orig 2006-10-12
08:53:17.000000000 +0200
+++ debian/utils/mldonkey_server.ml 2006-10-12 09:32:35.000000000
+0200
@@ -273,8 +273,7 @@
ignore (print_log st str)
let go_home st =
- debug st ("Chdir to home dir: " ^ (user_home st));
- Unix.putenv "HOME" (user_home st);
+ debug st ("Chdir to chdir dir: " ^ (get_chdir st));
Unix.putenv "MLDONKEY_STRINGS" (Filename.concat (get_chdir st)
"mlnet_strings");
Sys.chdir (get_chdir st)
Reply to: