On Mon, Jul 24, 2017 at 03:15:32PM +0800, Michael W. Bombardieri wrote:
> Hi,
>
> In make(1), do_run_command() has a sanity check for a null command string.
> The error message passes the null string to printf(). Is this any better?
>
> - Michael
>
>
> Index: engine.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/make/engine.c,v
> retrieving revision 1.53
> diff -u -p -u -r1.53 engine.c
> --- engine.c 9 Jul 2017 15:28:00 -0000 1.53
> +++ engine.c 24 Jul 2017 06:58:31 -0000
> @@ -752,7 +752,7 @@ do_run_command(Job *job)
> /* How can we execute a null command ? we warn the user that the
> * command expanded to nothing (is this the right thing to do?). */
> if (*cmd == '\0') {
> - Error("%s expands to empty string", cmd);
> + Error("command expands to empty string");
> return false;
> }
>
Good catch. I'll do something better, since I know where the command
comes from, so I can display a proper error message with line number,
and (more importantly) the string before substitution.