From e9058803d32629ecc5de2ad96c078a1a8dbdbf3a Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 17 Aug 2024 14:58:56 -0600 Subject: [PATCH] mm(1): fixes to pledge(2) now; tests: bonsai/mm.mk: adds test for regression --- src/mm.rs | 2 +- tests/bonsai/mm.mk | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mm.rs b/src/mm.rs index d5f1563..aee9aa2 100644 --- a/src/mm.rs +++ b/src/mm.rs @@ -52,7 +52,7 @@ fn main() -> ExitCode { let usage = format!("Usage: {} [-aetu] [-i input] [-o output]", argv[0]); if cfg!(target_os="openbsd") { - let promises = Promises::new("rpath stdio unveil"); + let promises = Promises::new("cpath rpath stdio unveil wpath"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); return ExitCode::from(EX_OSERR as u8); diff --git a/tests/bonsai/mm.mk b/tests/bonsai/mm.mk index 2800460..124d284 100755 --- a/tests/bonsai/mm.mk +++ b/tests/bonsai/mm.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2024 E$(NAME)a Tebibyte +# Copyright (c) 2024 Emma Tebibyte # SPDX-License-Identifier: FSFAP # # Copying and distribution of this file, with or without modification, are @@ -6,7 +6,7 @@ # notice are preserved. This file is offered as-is, without any warranty. .PHONY: mm_tests -mm_tests: mm_args mm_help mm_stderr +mm_tests: mm_args mm_help mm_stderr mm_remaining .PHONY: mm_none mm_none: $(BIN)/mm @@ -25,3 +25,10 @@ mm_help: $(BIN)/mm # check if stderr is empty upon specifying -e mm_stderr: $(BIN)/mm test "$$(printf 'test\n' | $(BIN)/mm -e 2>&1 >/dev/null )" = "test" + +.PHONY: mm_remaining +# check to make sure remaining arguments are used +mm_remaining: $(BIN)/mm + test "$$($(BIN)/mm -i README COPYING)" = "$$(cat README COPYING)" + $(BIN)/mm -i README -o /tmp/mm_test0 /tmp/mm_test1 + diff /tmp/mm_test0 /tmp/mm_test1