Macaulay2 / Macaulay2/M2

run ignores interrupts, but its documentation says terminal signals reach Macaulay2

Open
#4,567 0 comments 0 reactions 0 assignees View on GitHub
bugs directory Documentation
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from [`bugs/dan/1-document-run`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/1-document-run), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.

### The original file, verbatim

```text
document "run" about it ignoring interrupts, and returning the interrupt code, e.g., 2
```

### Where it stands today

Half met, and the other half is **contradicted** by the current text.

### The return-code half is documented

`ov_system.m2:855-867` documents the encoding including "2 for interrupt", added by `42ade68981`
(2014-08-26).

### The interrupt-ignoring half says the opposite

`ov_system.m2:851-854` reads: *"signals invoked by control characters at the terminal will go both to it
and to Macaulay2."* But `run` is libc `system()` (`d/scclib.c:850-855`), which sets `SIGINT` and
`SIGQUIT` to `SIG_IGN` **in the parent** for the child's duration. Measured by having M2 signal itself
from inside `run`:

```m2
i1 : ppp = processID()
i2 : rrr = run("kill -INT " | toString ppp)
o2 = 0
i3 : print "SURVIVED"
SURVIVED
```

Delivery is real — same process group — but M2 ignores it. So Ctrl-C kills only the command, `run`
returns 2, and the documentation tells the reader to expect otherwise.

### Related

**#1082** asks to redesign what `run` and `wait` return and to stop shelling through `/bin/sh`, which
would change what needs documenting here — so the two are worth settling in order.

`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)

Contributor guide

No contributing guide indexed for this repository

Research direction

Read ov_system.m2:851-867 and d/scclib.c:850-855 to compare the documented and libc system() behavior. Reproduce the self-signaled run example, then review #1082 before deciding whether the implementation or documentation should change. Done means run's interrupt behavior and its documented signal and return-code semantics agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.