BobBuildTool/bob

Trying to build a non-existend package should be an error

ThomasFeher opened this issue · 4 comments

Bob currently does not return an error in case the package name does not exist,
but only a message on stdout. In my case this lead to a successful test,
although nothing was build, because of a typo. In my opinion Bob should return
something unequal to 0 in such cases.

The reason is that all package names are actually queries that do not need to match anything. The original design decision was to make Bob behave like bash's nullglob. That's what happened in your case. But I see your point and the current behaviour is not very user friendly.

I think we have a couple of options:

  1. Treat all package queries that match no package as error.
  2. Queries with wildcards that match no package are silently ignored. But queries without wildcards that match no package are treated as error.
  3. Keep the current behaviour

I'm leaning towards 1. Note that this basically affects all commands that take package names. Especially the query- commands should keep the old behaviour because they are intended for scripting and should stay backwards compatible. I'm not sure if somebody relies on this behaviour. If we change the behaviour then it should be done consistently for all commands, though.

I guess it makes sense to make this configurable, e.g. bob -O nullglob dev ... to return to the current behaviour...

I would lean towards 2, because that is what I would have expected intuitively (not knowing about nullglob before), and it seems to be what nullglob does as well. 1 would still be ok for me, though.

I'd also prefer to have consistent behaviour for all commands. I'm currently not relying on that behaviour in my scripts, though.

Please have a look at #492. The PR adds a global --query=nullset/nullglob/nullfail option to select the desired policy. The old behaviour was nullset which treated any non-matching query as empty package set without error. The new default, nullglob, is the option 2 from above. For the sake of completeness there is nullfail that treats any empty package set as error.

If there aren't any objections (@rhubert , @Ferruck ?) then I'll merge it soonish...

👍 shouldn't cause any issues here..