Re: htdig: htmerge: Word sort failed

Rikard Elofsson (
Wed, 25 Feb 1998 09:46:03 +0100

At 13:50 1998-02-21 +0100, you wrote:

>There are some differences in the environment of the two processes. The
>cron job probably runs as a different user in different groups, it has
>no controlling terminal, other setting of environment variables such as
>PATH and TMPDIR, perhaps another working directory or different settings
>of the ulimit values.

Checked that, and htmerge still runs fine from command line if you modify
your environment and user/group-settings to the ones that cron uses. The
only reservation is SHLVL, rundig as a cron-job has SHLVL 3 but when you
run it from the command line you are in SHLVL 1.

>an example, the two processes could be using different tmp directories
>(the /tmp full was my first hunch as well, when I saw the initial

TMPDIR is not set so /bin/sort (where the problem is, see below) use its
standard directory both ways.

>If you are really desparate you can run htmerge with strace to see
>exactly which system call is failing and the corrisponding errno code,
>but it will probably be very slow.

Theres no need to use strace, there's only one way for the "Word sort
failed"-message to appear - if pclose of the pipe to /bin/sort fails. I.e.
htmerge succeds with the opening of the pipe (different error message if
that fails) and reads all the lines from the pipe (rundig -v generates a
rather large mail with cron output and you can se the sort command with ps
when it runs) but when it comes to closing the pipe pclose returns -1 and
htmerge dies.

I'm no wizard so please don't ask me why this happens only when you run it
from cron on RedHat 5.0, but perhaps my description can ring a bell? I can
understand if there is differences in how fork() (called by popen) works if
you are in SHLVL 1 or 3 but I can't fix the problem.

My (I hope) temporary workaround is to comment out the error check of
pclose around line 219 in Q&D - but it works... :)

Rikard Elofsson
Tingvallagymnasiet Telefon 054 - 29 69 73
Box 158 Telefax 054 - 29 69 60
651 05 Karlstad Mobiltel 070 - 664 52 48
To unsubscribe from the htdig mailing list, send a message to containing the single word "unsubscribe" in
the body of the message.

This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:25:42 PST