print cmdline of failing command?

5 views
Skip to first unread message

Evan Laforge

unread,
Mar 3, 2018, 7:05:16 PM3/3/18
to Shake build system
Is it my imagination, or did shake used to print the complete cmdline
of a failing command, and no longer does that? Here's what I'm
getting now:

% mk build/test/obj/Util/Audio/Binding.hs.o
GHC Test: build/chs/Util/Audio/Binding.hs

shakefile: Error when running Shake build system:
* build/test/obj/Util/Audio/Binding.hs.o
* build/test/obj/Util/Audio/Binding.hs.o build/test/obj/Util/Audio/Binding.hi
Error, &?> rule failed to build 2 files (out of 2)
build/test/obj/Util/Audio/Binding.hs.o - MISSING
build/test/obj/Util/Audio/Binding.hi - MISSING
CallStack (from HasCallStack):
error, called at src/Development/Shake/Rules/Files.hs:148:13 in
shake-0.15.11-5PYS6uafDznEyPx1Vu5qEs:Development.Shake.Rules.Files


This is a totally legit error (the "module ... where" line was
incorrect... though I feel ghc should complain instead of silently
putting the .o in a different place). And thanks for the explicit
message, I recall it used to be not so clear what went wrong. But I
seem to recall that shake used to print out the complete cmdline that
failed, which was convenient. Now I have to rerun with -V, which is
not a big deal, but still shake doing it automatically was a nice
touch.

This is 0.15.11, which is not quite the latest, but I don't see
anything in the changelog about changing logging.

Neil Mitchell

unread,
Mar 4, 2018, 2:48:07 AM3/4/18
to Evan Laforge, Shake build system
Hi Evan,

If a command fails it prints out the command line that failed, that is true and remains true.

However, here you have a rule that failed to produce its target - the command itself succeeded - but the rule is wrong - so there's no command to print. In this case it just identifies the rule by it's target files.

In a future Shake this will print out the location of the rule, but still not the command line, since the command has succeeded and finished. I guess it could store the last command line and offer that up if a rule fails, but it's very much a heuristic hint at a guess at what failed - the command line might have worked and done what was expected.

Thanks, Neil

Evan Laforge

unread,
Mar 4, 2018, 7:06:44 PM3/4/18
to Neil Mitchell, Shake build system
On Sat, Mar 3, 2018 at 11:48 PM, Neil Mitchell <ndmit...@gmail.com> wrote:
> Hi Evan,
>
> If a command fails it prints out the command line that failed, that is true
> and remains true.
>
> However, here you have a rule that failed to produce its target - the
> command itself succeeded - but the rule is wrong - so there's no command to
> print. In this case it just identifies the rule by it's target files.

Of course you are correct. Shortly after I sent the email I had a
actual command fail and realized my mistake. Sorry about the bother
:)

> In a future Shake this will print out the location of the rule, but still
> not the command line, since the command has succeeded and finished. I guess
> it could store the last command line and offer that up if a rule fails, but
> it's very much a heuristic hint at a guess at what failed - the command line
> might have worked and done what was expected.

Yes, I agree, in this case shake is doing the right thing.

I feel I should go look into getting ghc to emit a warning when the
module line differs from the filename. It's an uncommon problem, but
confusing when it happens.
Reply all
Reply to author
Forward
0 new messages