execute_cmd.c assumes that the value in time_t shell_start_time is in ticks,
Yes, in that particular case, this is a problem.
as how one would get it from a call to the times() function. But for some reason, shell.c puts seconds in it, rather than ticks.
It should be seconds, since it backs $SECONDS and other things that the shell uses with seconds granularity.
Moreover, execute_cmd.c uses times() as a fallbask for !defined (HAVE_GETTIMEOFDAY), yet shell.c uses a call to gettimeofday() to put those seconds in shell_start_time.
Bash provides a replacement version of gettimeofday() in lib/sh/gettimeofday.c. That, however, only fills in the seconds and is useless for command timing.
In execute_cmd.c this bug breaks things in "if (posixly_correct && nullcmd)".
Are you on a system that doesn't provide getrusage()? That's required by
POSIX.
In any case, it should be shell_start_time * get_clk_tck() in that case
to make sure tbefore is in CLK_TCKs and fulfill that peculiar requirement,
since POSIX requires a command argument. It still won't be very granular.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
