Skip to content

Commit

Permalink
src/sage/doctest/control.py: log cysignals crashes to DOT_SAGE
Browse files Browse the repository at this point in the history
We set CYSIGNALS_CRASH_LOGS="$DOT_SAGE/crash_logs" in sage-env, but
currently, are are overriding that with a temporary directory in the
DocTestController's run_val_gdb() method.

For consistency, it makes more sense to place the doctest crash logs
in the same place as the "regular" crash logs. Doctest crashes are
important too, and if they are worth retaining at all, they are worth
retaining beyond a reboot or ten days (the current systemd
default). On the other hand, if the logs were truly transient, they
could be disabled by setting CYSIGNALS_CRASH_LOGS to an empty value.
Since we are making some effort to save them, they should be
considered more persistent than not.
  • Loading branch information
orlitzky committed Sep 22, 2023
1 parent 80f6d77 commit 351a0a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import sage.misc.randstate as randstate
from sage.structure.sage_object import SageObject
from sage.env import DOT_SAGE, SAGE_LIB, SAGE_SRC, SAGE_VENV, SAGE_EXTCODE
from sage.misc.temporary_file import tmp_dir
from cysignals.signals import AlarmInterrupt, init_cysignals

from .sources import FileDocTestSource, DictAsObject, get_basename
Expand Down Expand Up @@ -1342,9 +1341,10 @@ def run_val_gdb(self, testing=False):
if testing:
return

# Setup signal handlers.
# Save crash logs in temporary directory.
os.putenv('CYSIGNALS_CRASH_LOGS', tmp_dir("crash_logs_"))

# Setup signal handlers. Crashes are logged to the directory
# specified by CYSIGNALS_CRASH_LOGS, typically set by sage-env
# to a subdirectory of DOT_SAGE.
init_cysignals()

import signal
Expand Down

0 comments on commit 351a0a2

Please sign in to comment.