`configure` mishandles the default and `--disable-*` forms of the safety options
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
Bug description:
Summary
configure.ac mishandles the safety and slower-safety configure options.
- A default
configureinvocation reportssafetyas disabled, although the safety options are intended to be enabled by default. --disable-safetyenables the safety options instead of disabling them.--disable-slower-safetyenables the slower safety options instead of disabling them.
The latter two cases are not only incorrect status messages: configure actually enters the corresponding enabled branches and probes the associated compiler options.
Reproduction
Using an out-of-tree build directory:
mkdir build
cd build
Default configuration
../configure
Observed:
checking for --enable-safety... no
checking for --enable-slower-safety... no
Disable safety
../configure --disable-safety
Observed:
checking for --enable-safety... yes
checking whether C compiler accepts -fstack-protector-strong... yes
checking whether C compiler accepts -Wtrampolines... yes
checking whether C compiler accepts -Wimplicit-fallthrough... yes
checking whether C compiler accepts -Werror=format-security... yes
checking whether C compiler accepts -Wbidi-chars=any... yes
checking whether C compiler accepts -Wall... yes
checking for --enable-slower-safety... no
Disable slower safety
../configure --disable-slower-safety
Observed:
checking for --enable-safety... no
checking for --enable-slower-safety... yes
checking whether C compiler accepts -D_FORTIFY_SOURCE=3... yes
Actual Behavior
The resulting behavior is:
| Configure invocation | safety |
slower-safety |
|---|---|---|
../configure |
no |
no |
../configure --disable-safety |
yes |
no |
../configure --disable-slower-safety |
no |
yes |
In particular, the two --disable-* forms enable the options they are intended to disable.
Expected Behavior
The expected behavior is:
| Configure invocation | safety |
slower-safety |
|---|---|---|
../configure |
yes |
no |
../configure --enable-safety |
yes |
no |
../configure --disable-safety |
no |
no |
../configure --enable-slower-safety |
default value for safety |
yes |
../configure --disable-slower-safety |
default value for safety |
no |
In particular:
safetyshould remain enabled by default unless explicitly disabled.--disable-safetyshould setenable_safety=noand should not execute the safety compiler-option checks.--disable-slower-safetyshould setenable_slower_safety=noand should not execute the slower-safety compiler-option checks.
Cause
The affected declarations are in configure.ac in the AC_ARG_ENABLE([safety], ...) and AC_ARG_ENABLE([slower-safety], ...) blocks.
Their action-if-given branches currently test variables named disable_safety and disable_slower_safety.
For an AC_ARG_ENABLE option, Autoconf represents both forms through the corresponding enable option value:
--enable-safety -> enableval=yes
--disable-safety -> enableval=no
Likewise for slower-safety.
The current action blocks do not use that value. Instead, because disable_safety / disable_slower_safety are not the variables carrying the Autoconf option state, the fallback branch selects the enabled state whenever either option is explicitly present.
This causes:
--disable-safety
-> action-if-given runs
-> disable_safety is not "yes"
-> enable_safety=yes
and similarly:
--disable-slower-safety
-> enable_slower_safety=yes
There is also a separate default-value issue in the safety declaration: its action-if-not-given branch currently selects enable_safety=no, despite the option being intended to be enabled by default.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-156767
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in configure.ac bei den Blöcken AC_ARG_ENABLE([safety], ...) und AC_ARG_ENABLE([slower-safety], ...), und führe dann die drei aufgeführten Aufrufe aus einem Out-of-Tree-Build-Verzeichnis heraus erneut aus. Vergleiche den erzeugten Status und die Compileroptionsprüfungen mit der erwarteten Tabelle; als erledigt gilt die Aufgabe, wenn die Standardform sowie die expliziten Enable-/Disable-Formen die dokumentierten Zustände auswählen, ohne unerwünschte Prüfungen durchzuführen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- shell
- Bereich
- build-system
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100