Skip to content

Commit ed3b40c

Browse files
committed
chore: fix ci
1 parent 934e620 commit ed3b40c

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
name: upstream
122122
path: upstream/
123123
- name: Install system deps
124-
run: sudo apt-get update && sudo apt-get install -y libcap-dev
124+
run: sudo apt-get update && sudo apt-get install -y bubblewrap libcap-dev
125125
- name: Enable unprivileged user namespaces (required by bubblewrap)
126126
run: |
127127
# Required for bubblewrap to work on Linux CI runners.
@@ -151,7 +151,7 @@ jobs:
151151
include:
152152
- os: macos-latest
153153
- os: ubuntu-latest
154-
system-deps: libcap-dev
154+
system-deps: bubblewrap libcap-dev
155155
enable-userns: true
156156
runs-on: ${{ matrix.os }}
157157
steps:
@@ -204,7 +204,7 @@ jobs:
204204
include:
205205
- os: macos-latest
206206
- os: ubuntu-latest
207-
system-deps: libcap-dev
207+
system-deps: bubblewrap libcap-dev
208208
enable-userns: true
209209
runs-on: ${{ matrix.os }}
210210
steps:

UPSTREAM_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
rust-v0.131.0-alpha.22
22
# commit: 9b8cf56cdefb09f54564ccc295fd42f6647f558f
3-
# synced: 2026-05-16T19:45:09Z
3+
# synced: 2026-05-16T21:01:55Z

crates/zerobox/src/main.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,29 @@ fn exit_code_from_status(status: std::process::ExitStatus) -> ExitCode {
133133
}
134134

135135
fn main() -> ExitCode {
136+
#[cfg(target_os = "linux")]
137+
if invoked_as_linux_sandbox_helper() {
138+
zerobox_linux_sandbox::run_main();
139+
}
140+
136141
tokio_main()
137142
}
138143

144+
#[cfg(target_os = "linux")]
145+
fn invoked_as_linux_sandbox_helper() -> bool {
146+
use zerobox_sandboxing::landlock::ZEROBOX_LINUX_SANDBOX_ARG0;
147+
148+
let Some(argv0) = std::env::args_os().next() else {
149+
return false;
150+
};
151+
152+
std::path::Path::new(&argv0)
153+
.file_name()
154+
.is_some_and(|name| name == std::ffi::OsStr::new(ZEROBOX_LINUX_SANDBOX_ARG0))
155+
}
156+
139157
#[tokio::main]
140158
async fn tokio_main() -> ExitCode {
141-
#[cfg(target_os = "linux")]
142-
{
143-
use zerobox_sandboxing::landlock::ZEROBOX_LINUX_SANDBOX_ARG0;
144-
let exe_name = std::env::args_os()
145-
.next()
146-
.as_ref()
147-
.and_then(|s| Path::new(s).file_name().map(|f| f.to_os_string()));
148-
if exe_name.as_deref() == Some(std::ffi::OsStr::new(ZEROBOX_LINUX_SANDBOX_ARG0)) {
149-
zerobox_linux_sandbox::run_main();
150-
}
151-
}
152-
153159
let cli = Cli::parse();
154160

155161
if let Some(CliSubcommand::Snapshot { action }) = &cli.subcommand {

0 commit comments

Comments
 (0)