bugmake - Bugs: bug #58013, .SILENT no longer suppresses...


bug #58013: .SILENT no longer suppresses "Entering directory"

Submitted by:  None
Submitted on:  Fri 20 Mar 2020 08:06:48 AM UTC  
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.3 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Sat 21 Mar 2020 10:10:21 PM UTC, comment #9: 

FWIW I thought of another way to do this in a portable way:

submake: ; GNUMAKEFLAGS=--no-print-directory $(MAKE) recurse

or some form of that.

Paul D. Smith <psmith>
Project Administrator
Sat 21 Mar 2020 05:29:25 PM UTC, comment #8: 

To be clear, I was not suggesting we revert the change that .SILENT no longer adds -s to submakes.  The 4.3 behavior is correct in that respect and I'm not thinking of changing it back.

The only question is whether .SILENT should suppress the "Entering directory" messages (in the current instance of make) or not.  However, now that I think about what that would involve I guess it probably can't be done since we'll want to print these messages before anything else is printed but we can't know whether to suppress them until we've read the makefile and seen (or not) .SILENT.

You can add -s to the sub-make invocation but note that moves responsibility from the user (adding -s to their command line) to the makefile author.

Ensuring that this will work properly (that can be overridden by the user) in a way that is still portable to other versions of make is a little tricky but probably can be done the same way we do it with .SILENT.  Something like this perhaps:

submake: ; $(MAKE) $(SOPT) recurse

$(V)SOPT = -s

Now if you run `make` it will be silent but if you run `make V=1` you will get verbose mode.

The only real change is that previously this could be decided on a per makefile basis, but with this model once you enable the -s it's always there for all submakes.

Regarding POSIX: since the standard doesn't say anything about any "Entering" messages, it's not a violation of the standard to print them or not print them either way.  The standard DOES say that .SILENT and -s have the same behavior, so there's an argument to be made on that footing but ultimately no standard-conforming makefile will be incorrectly processed which is all that really matters for conformance.

As for which other messages to suppress, I think there's a clear difference that is easy to make and understand between messages the user asked for via warning etc., or implicitly by asking for an operation that generated an error, and informational output like "Entering" messages.

However since it seems there's no good way to get back just the "silence Entering" behavior without also the unwanted "inherit .SILENT" behavior, the argument is moot.

I'm going to close this issue but feel free to continue to discuss if you like.

Paul D. Smith <psmith>
Project Administrator
Sat 21 Mar 2020 04:36:47 PM UTC, comment #7: 

Posix is explicit that -s and .SILENT are both about command lines.
If we wanted to be strictly posix conformant 'Entering directory' should be printed even when -s is specified.
if .SILENT is stretched to suppress other messages such as 'Entering directory' the question arises which other messages should .SILENT suppress?
e.g. if the directory is not executable make prints "permission denied". Should "permission denied" be suppressed? What about $(warning ) messages, "is up to date" messages, etc?

Dmitry Goncharov <dgoncharov>
Sat 21 Mar 2020 03:15:14 PM UTC, comment #6: 

It's always important when thinking about make to keep the orthogonality in mind of which behaviors should be under control of the makefile (e.g. .SILENT) and which under control of the user (-s). In this case it seems to me that a makefile (especially a generated makefile) which can assert .SILENT can also add the -s flag (which is in POSIX) to $(MAKE) recipe lines with no loss to flexibility in other use cases. Thus IMHO the current behavior is best, compatibility issues aside,  and I think CMake should use explicit -s flags to sub-makes in addition to .SILENT no matter which decision is made here.

Of course "compatibility issues aside" is a bit flippant and if the decision is made to revert the change I (who posted the original bug 54740) will raise no objection.  Especially since POSIX does say "the behavior of .SILENT should be the same as if -s was passed". I think this is unfortunate, and in fact I think it's not at all clear the transitive property of -s (being added to MAKEFLAGS for sub-makes) was intended, but the standard is what the standard says.

David Boyce <boyski>
Sat 21 Mar 2020 01:48:00 PM UTC, comment #5: 

That's one way to look at it.  The problem is that in 4.3 there is no portable way to avoid printing these lines from within the makefile.  Any remedy requires that you know that your makefile is going to be run with GNU make: you can't write a generic makefile that works with other versions of make and still suppresses these lines.

I guess once the += operator is standardized you could use "MAKEFLAGS += -s" and that would probably be portable.

Plus the POSIX standard does explicitly state that `-s` and `.SILENT:` with no prerequisites should do the same thing.  Of course, the standard only talks about suppressing recipe lines so there's some wiggle room there for extra-standard behavior.

Paul D. Smith <psmith>
Project Administrator
Sat 21 Mar 2020 01:32:04 PM UTC, comment #4: 

"Entering directory' message when the user is not expecting one is a benign backward incompatibility. i'd be more concern about the opposite.
Also, reinstating the prior behavior is incompatible with 4.3.

Dmitry Goncharov <dgoncharov>
Sat 21 Mar 2020 01:05:18 PM UTC, comment #3: 

The title of this bug is clearly not right.  .SILENT is certainly not ignored: it still will suppress the printing of recipe lines which is exactly what the documentation says it will do.  I'll update the title.

I think "intentional" might be overstepping.  It's more an unexpected side-effect of fixing a different problem.

The documentation is pretty clear that the .SILENT special target applies only to recipes, and as such I would never have expected it to suppress the "Entering directory" statements.  The implementation, however, previously used the same flag as the `-s` option and the `-s` option also suppresses "Entering directory" statements.  When bug #54740 was fixed, .SILENT no longer just piggy-backs on the implementation of `-s` and so this side-effect was removed.

Our options are to either leave things as they are now, where the implementation matches the manual but is no longer backward-compatible with previous implementations, or to change both the implementation and documentation so they re-instate the previous behavior and make that behavior official.

Paul D. Smith <psmith>
Project Administrator
Sat 21 Mar 2020 01:26:15 AM UTC, comment #2: 

Thanks for the link. I see this in the 4.3 release notes now that I know what I was looking for:

> [SV 54740] Ensure .SILENT settings do not leak into sub-makes

I've filed an issue on our side to handle this new behavior.



Ben Boeckel <mathstuf>
Sat 21 Mar 2020 01:06:24 AM UTC, comment #1: 

This is intentional.
See https://savannah.gnu.org/bugs/?54740.

Dmitry Goncharov <dgoncharov>
Fri 20 Mar 2020 08:06:48 AM UTC, original submission:  


I noticed that after upgrading GNU Make to 4.3 messages such as these:

make[1]: Entering directory '/.../test/a'
make[1]: Leaving directory '/.../test/a'

started to appear when building my project. The Makefile is a complex one which is generated by CMake. CMake tries to suppress such output by default, by inserting ".SILENT:" in the generated Makefile. Starting with GNU Make 4.3 this directive appears to be ignored, as illustrated with this toy project:

$ find . | sort
.   (directory)
./a (directory)

$ cat Makefile
all: a
a: %:
        $(MAKE) -C $@

$ cat a/Makefile
all: a
        echo hello



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by boyski (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by mathstuf (Posted a comment)
  • -email is unavailable- added by dgoncharov (Posted a comment)
  • -email is unavailable- added by mathstuf

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-03-21 psmith StatusNone => Not A Bug
        Open/ClosedOpen => Closed
    2020-03-21 psmith Summary.SILENT appears to be ignored in GNU Make 4.3 => .SILENT no longer suppresses "Entering directory"
    2020-03-20 mathstuf Carbon-Copy- => Added mathstuf

    Back to the top

    Powered by Savane 3.5