janestreet / janestreet/magic-trace
Failure to remove perf.data is fatal
- Dominant language
- OCaml
- Stars
- 6.3k
- Forks
- 209
- PR merge metrics
- No merged PRs in 30d
Description
On NixOS, `Shell.rm` fails to remove the `perf.data` file because it cannot find `/bin/rm`, which is a fatal error. This issue really lies with [shell](https://github.com/janestreet/shell), but I don't know enough OCaml to make an issue on a library. Regardless, failing to remove the tmp file should probably be non-fatal.
This is on version `1.2.1`
errors:
```
(monitor.ml.Error (Failure "fork_exec: Process not found /bin/rm")
("Raised at Stdlib.failwith in file \"stdlib.ml\", line 29, characters 17-33"
"Called from Unix_extended.fork_exec in file \"unix_extended/src/unix_extended.ml\", line 164, characters 16-67"
"Called from Low_level_process.internal_create_process in file \"low_level_process/src/low_level_process.ml\", line 43, characters 14-276"
"Re-raised at Low_level_process.internal_create_process in file \"low_level_process/src/low_level_process.ml\", line 67, characters 4-11"
"Called from Low_level_process.create in file \"low_level_process/src/low_level_process.ml\", line 342, characters 4-98"
"Called from Low_level_process.run in file \"low_level_process/src/low_level_process.ml\", line 422, characters 14-301"
"Called from Shell.Process.run_k.(fun) in file \"src/shell.ml\", line 181, characters 16-37"
"Called from Magic_trace_lib__Trace.Make_commands.record_flags.(fun) in file \"src/trace.ml\", line 553, characters 26-57"
"Called from Async_kernel__Monitor.Exported_for_scheduler.schedule'.upon_work_fill_i in file \"src/monitor.ml\", line 293, characters 42-51"
"Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 180, characters 6-47"
"Caught by monitor finally"))
```
Contributor guide
Research direction
Start at src/trace.ml line 553 and follow the cleanup call into src/shell.ml line 181, using the reported stack trace to understand how failure to run /bin/rm is handled. Done means an unavailable /bin/rm during perf.data cleanup no longer makes tracing fatal, with behavior checked on NixOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100