#1153005 sudo: prevent duplicate Bison invocations during parallel sudoers builds

Package:
sudo
Source:
sudo
Description:
Provide limited super user privileges to specific users
Submitter:
Marcel Jueling
Date:
2026-11-04 10:23:02 UTC
Severity:
normal
Tags:
#1153005#5
Date:
2026-11-04 10:21:11 UTC
From:
To:
The sudoers parser generation rule in plugins/sudoers/Makefile.in
declares gram.c and gram.h as ordinary multiple targets:

|$(devdir)/gram.c $(devdir)/gram.h: $(srcdir)/gram.y prologue|

The recipe generates both files using Bison via the temporary files
y.tab.c and y.tab.h.

With this ordinary multiple-target rule, GNU make may execute the
recipe separately for each target during parallel builds. This can
cause duplicate Bison invocations and potentially race over the
temporary output files.

The rule should use a grouped target instead:

|$(devdir)/gram.c $(devdir)/gram.h &: $(srcdir)/gram.y prologue|

Grouped targets were introduced in GNU make 4.3, so this change
requires GNU make >= 4.3.

I tested the change on Debian trixie with GNU make 4.4.1 and
Bison 3.8.2.

For both the simple and LDAP build configurations, I removed the
generated parser files and ran parallel builds with make -j4.
A wrapper around Bison confirmed exactly one invocation for
gram.y in each configuration. The generated parser files were
identical to the previously generated files.

A subsequent full binary package build completed successfully.

The attached patch contains the proposed fix.

Best regards

Marcel Jueling