dune icon indicating copy to clipboard operation
dune copied to clipboard

`--display=quiet` has no effect on `--root`-changing messages

Open raphael-proust opened this issue 3 weeks ago • 2 comments

Expected Behavior

dune build --root=foo/bar blah --display=quiet should be quiet

Actual Behavior

dune build --root=foo/bar blah --display=quiet displays both Entering diretory 'foo/bar' and Leaving directory 'foo/bar' messages.

Reproduction

diff --git a/test/blackbox-tests/test-cases/quiet-root.t b/test/blackbox-tests/test-cases/quiet-root.t
new file mode 100644
index 000000000..4bf5017a5
--- /dev/null
+++ b/test/blackbox-tests/test-cases/quiet-root.t
@@ -0,0 +1,21 @@
+Document how Dune displays various things
+=========================================
+
+  $ echo '(lang dune 3.0)' > dune-project
+  $ export BUILD_PATH_PREFIX_MAP=SH=`command -v sh`
+
+Errors with location embed in their output
+------------------------------------------
+
+  $ mkdir foo/
+  $ cat >foo/dune-project<<"EOF"
+  > (lang dune 3.16)
+  > (package (name foo))
+  > EOF
+
+  $ dune build --root=foo/ @fmt
+  Entering directory 'foo'
+  Leaving directory 'foo'
+  $ dune build --root=foo/ @fmt --display=quiet
+  Entering directory 'foo'
+  Leaving directory 'foo'

Specifications

  • Version of dune (output of dune --version): 3.19.1
  • Version of ocaml (output of ocamlc --version): 4.14.0
  • Operating system (distribution and version): linux, debian

raphael-proust avatar Dec 03 '25 12:12 raphael-proust

I think we need these silly markers for programs like emacs to recognize dune's error message when they're relative to the root directory. This all comes from a convention from make that everybody's tooling latched on.

I'm not opposed to a flag that gets rid of this, but I do think it needs to stick around by default.

rgrinberg avatar Dec 03 '25 22:12 rgrinberg

if it's to accompany other error messages then one possibility I hadn't considered is that --display=quiet could make the entering/leaving messages only appear if there are error messages (so produce them lazily, only if needed).

I don't mind too much if there is some stuff displayed in case of an error.

raphael-proust avatar Dec 04 '25 08:12 raphael-proust

There's already --no-print-directory to suppress these messages. Producing them lazily has been discussed before, but I don't really remember why we haven't gone for this. I suppose I would accept a patch that did this if it wasn't very complicated.

rgrinberg avatar Dec 15 '25 00:12 rgrinberg

Would you accept a patch that would set --no-pront-directory if --display=quiet is passed?
it seems more reasonable ux to me (but maybe that's more personal taste)

raphael-proust avatar Dec 15 '25 14:12 raphael-proust

@raphael-proust I can make the messages lazy if that satisfies your need. i.e. only print entering/leaving when there is something to print.

Alizter avatar Dec 15 '25 14:12 Alizter