Silence polymake's informational messages - #27
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #27 +/- ##
==========================================
+ Coverage 70.74% 72.00% +1.26%
==========================================
Files 15 15
Lines 810 868 +58
==========================================
+ Hits 573 625 +52
- Misses 237 243 +6
🚀 New features to boost your workflow:
|
fingolfin
force-pushed
the
quiet-polymake
branch
from
August 16, 2026 20:41
5a0658d to
a552ba6
Compare
polymake reports the credits of third-party software it uses and notes when it converts a data file to a newer format. These messages went straight to the terminal, interleaved with GAP output. They cannot be turned off through polymake's own settings because polymaking passes --config-path "", which disables all user configuration. Instead set $Polymake::User::Verbose::credits and ::files in pm_script_arg.pl, which works whatever the config path is. This is controlled by the new PolymakeQuiet preference and on by default. Two further preferences: PolymakeConfigPath, for users who do want their polymake configuration honoured, and PolymakePreferences, to pass rule preferences such as "*.convex_hull cdd". The script now also redirects stderr to a file that GAP reads back, so polymake diagnostics are no longer lost: they are shown at InfoPolymaking level 2, and on failure become part of the error message and of POLYMAKE_LAST_FAIL_REASON, which used to report just an exit code. Along the way, two bugs in the failure paths of Polymake: - UpdatePolymakeFailReason was called after Error, so it only ever ran if the user resumed from the break loop - the multi-keyword branch tested `returnedstring <> []` on the result record rather than on `returnedstring.string`, which was always true Fixes #23. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fingolfin
force-pushed
the
quiet-polymake
branch
from
August 16, 2026 21:45
a552ba6 to
918c011
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
polymake prints the credits of third-party software it uses, and notes when it converts a data file to a newer format. These went straight to the terminal, interleaved with GAP output:
Now:
Fixes #23. Stacked on #26.
Why not just honour the user's polymake config
As #23 notes, these messages can be turned off in
~/.polymake/settings--but polymaking passes
--config-path "", which disables all userconfiguration, so those settings never apply.
Dropping the flag is tempting: with an empty config path
_applications::configuredis empty, so polymake re-runs everyCONFIGUREblock on every call. But measured, that is worth only about 40ms of the
~850ms a call takes -- the bulk is loading the
polytoperules, which happenswhatever the config path is. And dropping it would make polymake create and
write
~/.polymake, fail where$HOMEis unwritable (sandboxed distrobuilds), and make results depend on the user's
prefersettings.Instead the script sets
$Polymake::User::Verbose::creditsand::filesdirectly, which works whatever the config path is -- polymake's own test
harness does the same (
Test/Environment.pm:65,Test/BigObject.pm:165).Users who do want their configuration honoured can now set
PolymakeConfigPathto"user".New preferences
PolymakeQuiettruePolymakeConfigPath""--config-pathPolymakePreferences[ ][ "*.convex_hull cdd" ]Capturing stderr
pm_script_arg.plgained an option head (--stderr FILE,--quiet,--prefer EXPR,--terminator). Reassociating theSTDERRglob catchesdbg_printas well aserr_print/warn_print, which write to$Polymake::console, and polymake's own fatal error handler.GAP reads the file back, so diagnostics are no longer lost. They are shown at
InfoPolymakinglevel 2, and on failure become part of the error message andof
POLYMAKE_LAST_FAIL_REASON:Previously that was just
polymake returned an error (error code 1).Two bugs found along the way
UpdatePolymakeFailReasonwas called afterError, soPOLYMAKE_LAST_FAIL_REASONwas only ever set if the user resumed from thebreak loop.
returnedstring <> []on the result recordrather than on
returnedstring.string, so it was always true.Notes on the implementation
prefer_nowdoes not work under--script:$Polymake::User::applicationisa stub whose
prefsare unset, so it dies withCan't call method set_temp_preference on an undefined value. The preference is applied to theobject's own application instead, with
Mode::createrather than the usualMode::strict--strictsets$Prefs->changed, which would make polymakerewrite the user's settings file when a config path is in use.
Testing
tst/testall.g: 0 failures.PolymakeQuiet := falsebrings the messages back, that a failing callpopulates
POLYMAKE_LAST_FAIL_REASONwith polymake's own message, and thatPolymakePreferencesreally switches backend (the credit line changes fromused package ppltoused package cdd, and the results change with it).🤖 Generated with Claude Code