VisionSystemsInc / VisionSystemsInc/vsi_common

signal_tools.bsh:trap_chain

Open
#242 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
8
Forks
9
Avg merge
36m
Merged PRs (30d)
1

Description

If I run make_temp_path TMP_DIR in a just target, this line causes a trap when run via just.

https://github.com/VisionSystemsInc/vsi_common/blob/aec3ddc7924042cadf6e6a37d82d7d3edb0eee60/linux/signal_tools.bsh#L75

Adding set -xv right before that line produces this

trap '' "${2}"; trap -p "${2}" | { read x ; echo "${x##* }"; }
++ trap '' EXIT
++ trap -p EXIT
++ read x
print_error "${BASH_SOURCE[0]}" "${LINENO}"
+++ print_error /Users/sgrichar/terra/external/vsi_common/linux/signal_tools.bsh 76
[snip]

The fix (66291fe) is simple, although why that fixes the problem is not clear:

-    last_info="$(trap '' "${2}"; trap -p "${2}" | { read x ; echo "${x##* }"; })"
+    last_info="$((trap '' "${2}"; trap -p "${2}") | { read x ; echo "${x##* }"; })"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to linux/signal_tools.bsh around line 75 and shows a reproduction through a just target. Read trap_chain and reproduce with make_temp_path TMP_DIR under just, then compare the reported trap behavior with the proposed one-line change and verify that the target no longer traps.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell
Domain
cli, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.