Skip to content

Conversation

@EdSchouten
Copy link
Contributor

On POSIX-like systems, processes may either terminate normally with an integer exit code. The exit code may span the full range of int, even though all but the waitid() function retur the bottom eight bits. In addition to that, processes may terminate abnormally due to a signal (SIGABRT, SIGSEGV, etc.)

POSIX shells (sh, bash, etc.) are more restrictive, in that they can only return exit codes between 0 and 126. 127 is used to denote that the executable cannot be found. Exit codes above 128 indicate that the process terminated due to a signal.

Right now we let test-setup.sh terminate using the exit code obtained using $?. This means that if a program terminates due to SIGABRT, test-setup.sh terminates with exit code 128+6=134. This causes us to lose some information, as the (remote) execution environment now only sees plain exit codes.

This change extends test-setup.sh to check for exit codes above 128. In that case it will send a signal to itself, so that the original signal condition is raised once again.

See also: bazelbuild/remote-apis#240

On POSIX-like systems, processes may either terminate normally with an
integer exit code. The exit code may span the full range of int, even
though all but the waitid() function retur the bottom eight bits. In
addition to that, processes may terminate abnormally due to a signal
(SIGABRT, SIGSEGV, etc.)

POSIX shells (sh, bash, etc.) are more restrictive, in that they can
only return exit codes between 0 and 126. 127 is used to denote that the
executable cannot be found. Exit codes above 128 indicate that the
process terminated due to a signal.

Right now we let test-setup.sh terminate using the exit code obtained
using $?. This means that if a program terminates due to SIGABRT,
test-setup.sh terminates with exit code 128+6=134. This causes us to
lose some information, as the (remote) execution environment now only
sees plain exit codes.

This change extends test-setup.sh to check for exit codes above 128. In
that case it will send a signal to itself, so that the original signal
condition is raised once again.

See also: bazelbuild/remote-apis#240
@EdSchouten EdSchouten requested review from coeuvre and tjgq July 1, 2023 11:57
@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jul 1, 2023
@EdSchouten EdSchouten requested a review from meisterT July 1, 2023 11:59
@sgowroji sgowroji added the team-Remote-Exec Issues and PRs for the Execution (Remote) team label Jul 2, 2023
@meisterT meisterT added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jul 13, 2023
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jul 13, 2023
@brentleyjones
Copy link
Contributor

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Jul 13, 2023
iancha1992 pushed a commit to iancha1992/bazel that referenced this pull request Jul 13, 2023
On POSIX-like systems, processes may either terminate normally with an integer exit code. The exit code may span the full range of int, even though all but the waitid() function retur the bottom eight bits. In addition to that, processes may terminate abnormally due to a signal (SIGABRT, SIGSEGV, etc.)

POSIX shells (sh, bash, etc.) are more restrictive, in that they can only return exit codes between 0 and 126. 127 is used to denote that the executable cannot be found. Exit codes above 128 indicate that the process terminated due to a signal.

Right now we let test-setup.sh terminate using the exit code obtained using $?. This means that if a program terminates due to SIGABRT, test-setup.sh terminates with exit code 128+6=134. This causes us to lose some information, as the (remote) execution environment now only sees plain exit codes.

This change extends test-setup.sh to check for exit codes above 128. In that case it will send a signal to itself, so that the original signal condition is raised once again.

See also: bazelbuild/remote-apis#240

Closes bazelbuild#18827.

PiperOrigin-RevId: 547773406
Change-Id: Ia29a6ea1eefdb8caa5624a799755b420a61478a0
@iancha1992
Copy link
Member

@bazel-io fork 6.3.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Jul 13, 2023
iancha1992 added a commit that referenced this pull request Jul 13, 2023
On POSIX-like systems, processes may either terminate normally with an integer exit code. The exit code may span the full range of int, even though all but the waitid() function retur the bottom eight bits. In addition to that, processes may terminate abnormally due to a signal (SIGABRT, SIGSEGV, etc.)

POSIX shells (sh, bash, etc.) are more restrictive, in that they can only return exit codes between 0 and 126. 127 is used to denote that the executable cannot be found. Exit codes above 128 indicate that the process terminated due to a signal.

Right now we let test-setup.sh terminate using the exit code obtained using $?. This means that if a program terminates due to SIGABRT, test-setup.sh terminates with exit code 128+6=134. This causes us to lose some information, as the (remote) execution environment now only sees plain exit codes.

This change extends test-setup.sh to check for exit codes above 128. In that case it will send a signal to itself, so that the original signal condition is raised once again.

See also: bazelbuild/remote-apis#240

Closes #18827.

PiperOrigin-RevId: 547773406
Change-Id: Ia29a6ea1eefdb8caa5624a799755b420a61478a0

Co-authored-by: Ed Schouten <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants