There are a few bugs in hlds_run that have been bugging me for some
time, and I hope posting them here might get it noticed by someone at
Valve who can fix them.
In the hlds_run file is the following code:
if test 1 -eq $PID_FILE_SET && test -n "$PID_FILE"; then
HL_CMD="$HL $PARAMS -pidfile $PID_FILE"
else
HL_CMD="$HL $PARAMS"
fi
What it does is check if the PID_FILE_SET variable equals 1 and the
PID_FILE variable is not empty. If both of those tests pass, then it
appends the -pidfile argument (along with the contents of the PID_FILE
variable) to the list of arguments to pass to the actual binary.
The problem is that if the list of arguments already contains this
information, -pidfile is passed to hlds_run more than once. You end up
with command lines like this:
./hlds_amd -debug -game cstrike -pidfile /usr/local/hlds/hlds.pid
+maxplayers 17 +map gg_pool_day -pidfile /usr/local/hlds/hlds.pid
What the code should be doing is adding those arguments if the -debug
parameter was passed, AND the -pidfile argument was not passed. Fixing
this one gets a little messy. (Related issue: PID_FILE_SET variable
should be removed from the code completely.)
Here's code that does what is is supposed to do and also sets a value
for the pidfile if the user doesn't properly pass it after -pidfile (the
arguments would look like "hlds_run ... -pidfile" in this erroneous
case).
PID_PASSED="`grep -e -pidfile $PARAMS`";
if test -n "$PID_PASSED" || test -n "$DEBUG"; then
if test -z "$PID_FILE"; then
PID_FILE="hlds.$$.pid"
fi
fi
if test -n "$DEBUG" && test -z "$PID_PASSED"; then
HL_CMD="$HL $PARAMS -pidfile $PID_FILE"
else
HL_CMD="$HL $PARAMS"
fi
Just above that code we find this gem:
if test "unlimited" != `ulimit -c` && test "`ulimit -c`" -eq 0 ; then
ulimit -c 2000
fi
It checks if the output from "ulimit -c" is not equal to "unlimited" AND
the output from "ulimit -c" equals 0. If it equals 0, it certainly isn't
equal to "umlimited" or anything else besides 0. The first line should
simply be:
if test "`ulimit -c`" -eq 0 ; then
The steam user and password junk should all be removed since that hasn't
been required in ages.
Also, the comment for line 25 has a typo, and is flat out wrong.
If anyone wants the file with all of the fixes in it, let me know and
I'll post it somewhere. (You too Valve; don't be shy.)
With that said, I'm glad to see that hlds_run was actually modified in
the hlds0319 beta.
--
Andy
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux