Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Enable operation on non-crate directories, bug fixes, doc fixes
Browse files Browse the repository at this point in the history
The major changes made in this commit are to how Carnet deals with
non-crate directories (now permitted instead of immediate failure).

Other notable bug fixes and features in this commit:

- Print help message when no argument is given.
- Only acknowledge the first command as such and treat what follows
  as normal arguments.
- First commit to contain Carnet signatures of itself.
  • Loading branch information
sam-ka committed May 23, 2021
1 parent 36e3215 commit 0a21b72
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 64 deletions.
1 change: 1 addition & 0 deletions .carnet/cookies.d/1db590b59b0f72a48d4f.cookie
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8ede68df4e3dd1681c59802c
1 change: 1 addition & 0 deletions .carnet/initialized
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
initialized
56 changes: 56 additions & 0 deletions .carnet/owners/1db590b59b0f72a48d4f.cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
-----BEGIN CERTIFICATE-----
MIIKCzCCBfOgAwIBAgIUHm8KK+4UUBwo6GKRRXMZE426aKwwDQYJKoZIhvcNAQEM
BQAwgYIxPjA8BgNVBAMMNVN1bGFpbWFuIEEuIEFsSWJyYWhpbSDYs9mE2YrZhdin
2YYg2KfZhNil2KjYsdin2YfZitmFMRwwGgYJKoZIhvcNAQkBFg1zYW1Aa2EuY29t
Lmt3MRUwEwYDVQQKDAxLdXRvbWV0YSBTUEMxCzAJBgNVBAYTAktXMCAXDTIwMTIy
NDA5MDA1OVoYDzIyOTQxMDA5MDkwMDU5WjCBgjE+MDwGA1UEAww1U3VsYWltYW4g
QS4gQWxJYnJhaGltINiz2YTZitmF2KfZhiDYp9mE2KXYqNix2KfZh9mK2YUxHDAa
BgkqhkiG9w0BCQEWDXNhbUBrYS5jb20ua3cxFTATBgNVBAoMDEt1dG9tZXRhIFNQ
QzELMAkGA1UEBhMCS1cwggQiMA0GCSqGSIb3DQEBAQUAA4IEDwAwgg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+zRcwkBbHrJWO5m88LRl
5NS2qGRA2bFlWAPA3HLDPIYxEyubrEhYscSdZk/VGJcPfGRCRwHiCJ5aLs4tMM+h
Ov8VYUMjtKSZl3tWTXlkn7DxPFd2Kc5OPeC8fVqOIoRoh4zcMVoXQKEzfs4DuSpM
FTlm19ASr8fao28Exa37xqQN3crfPeC5RRO+J/bFNbnA2THhaqEo0QuVRknGnqPR
hePyDQ5bnliT9t8f+gosxNNEh00nAJ0r1EShqG3qrkmO/yYvdqmHIzrSgG0aVBQF
n6o5Fa46mhsIpTvp+N3h/ju9cHZ4awAIvZC27wnZqO7Ciw+VX9cvjvWtsYtoAfbL
gIYYVwtHFUOz24Pi+wZMkAAuVEBI2pQNG+yEEP5UkzO5EGBnOx3qHFIdOQ9GN5U3
FzE6JJwE5IGB9jWO6NTPwlHcgFRVyFpqqtvtxZAQLZxR0Vo4gRp8QkjJR6IAwiPP
M4amnYjIzN9Ofi7fRt2ibEoxk6LD6b9avn7iulefjalgyCGEF3TJFQbvy3X2KQUg
ZLQmHyYhIM4XdmTCD6w2NxO6vd8Z4l5tet9DIUybII+wY9vYRbufhVuH6t8EcEqT
uUaMyUtKhpdj3CUCcbyviQa/kR74dcfLEpK39zLu8kxnnCCW+aHnXIVTrIfcsXfV
JeLsGspO3oNqePyEN/X/qwcs07WG+Z+QGADyDp3UXBVObyDHFW1rM2xKNhCzF1Zv
pV9q6v5v9VCyXYoKv1o0omgYkeNRBTd/vzr7ZJCBlgqdw8AjDoZiaWcvggU7hZe3
EyYBxDzznAccMQ7OZcFR1gGwbAriMHS9nYQXt/bb9g==
-----END CERTIFICATE-----
8 changes: 8 additions & 0 deletions .carnet/seal-ignore.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/\.git/
/\.git$
^\./target/
^\./\.carnet/seal/
/\.private-staging-mountpoint/
/target/
/Cargo.lock

1 change: 1 addition & 0 deletions .carnet/seal/sealed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sealed
Binary file added .carnet/seal/signatures.sha256
Binary file not shown.
Binary file not shown.
Binary file added .carnet/seal/signatures.sha384
Binary file not shown.
Binary file not shown.
Binary file modified .private-staging/EuhXwWP3KHituntu6prfcumglts1vivVI9bAfw42R3I
Binary file not shown.
27 changes: 27 additions & 0 deletions NEWS.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ This file documents noteworthy changes between each version of
Carnet.


### Noteworthy changes in v0.3.4 (2021-05-23)

This release contains last minute changes prior to project
announcement.

##### Breaking Changes

* None that we're aware of.

##### New Features

* Improved CLI ergonomics by showing expected help message when no
arguments are given
* Initializing, sealing, and verifying non-crate directories is now
permitted
* Improved documentation: The carnet:files command is now mentioned
in --carnet:help
* Improved Error messages
* Dogfooding from now on: The Carnet repository is now being signed
using Carnet.

##### Bug Fixes

* Fixed argument parsing bugs



### Noteworthy changes in v0.3.3 (2021-05-21)

This is the first publicly-released version of Carnet.
Expand Down
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The English version of the README file is currently located in
[README.md](README.md). It will be moved here later.
[README.md](README.md). It will be moved back here later.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
> life-cycle management are WIH.
Carnet is a small tool that imposes additional security constraints
on Rust's official package manager, Cargo. This tool aims to prevent
or otherwise limit the damage malicious crates can cause.
on Rust's official package manager, Cargo. It aims to prevent or
otherwise limit the damage malicious crates can cause.

Carnet imposes two types of security constraints on Cargo:

Expand Down
122 changes: 62 additions & 60 deletions carnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

PROJECT_NAME="carnet"
PROJECT_TITLE="Carnet: Bureaucracy for Cargo"
PROJECT_VERSION="0.3.3"
PROJECT_VERSION="0.3.4"
PROJECT_DATE="2021-05-21"
COPYRIGHT="Copyright © 2021 Kutometa SPC, Kuwait"
DESCRIPTION="Carnet is a small tool that imposes additional
security constraints on Rust's official package
manager, Cargo. This tool aims to prevent or
otherwise limit the damage malicious crates can
cause."
manager, Cargo. It aims to prevent or otherwise
limit the damage malicious crates can cause."
COPYRIGHT_BLURB="
$PROJECT_NAME $PROJECT_VERSION
$COPYRIGHT
Expand Down Expand Up @@ -177,7 +176,7 @@ ${BOLD-}USAGE${RESET-}
carnet [OPTIONS] [CARGO COMMANDS & OPTIONS]
carnet [OPTIONS] [CARNET COMMAND]
${BOLD-}GENERAL OPTIONS${RESET-}
--carnet:config-dir=... Override default configuration
Expand Down Expand Up @@ -207,15 +206,15 @@ ${BOLD-}SANDBOX OPTIONS${RESET-}
${BOLD-}AUTHENTICATION OPTIONS${RESET-}
--carnet:disable-verification Disable automatic verification.
See carnet:edit and carnet:done.
See carnet:edit and carnet:done.
${BOLD-}COMMANDS${RESET-}
carnet:help Show this help message and exit.
carnet:sandbox-run Run arbitrary commands in sandbox.
carnet:seal Seal current crate.
carnet:verify Verify current crate.
carnet:files View all files that get sealed.
carnet:own Set origin of current as local.
carnet:disown Set origin of current crate as foreign.
carnet:distrust Unregister the current crate from cache.
Expand Down Expand Up @@ -1203,7 +1202,7 @@ locate_known_crate_from_the_inside_and_set_up_global_variables() {
break
fi
if [[ "$( realpath -- "$KNOWN_CRATE_PATH" )" == "/" ]]; then
debug "Could not find Cargo.toml in this directory or any of its parents.\n"
debug "Could not find a crate in this directory or any of its parents.\n"
unset KNOWN_CRATE_PATH
unset KNOWN_CRATE_PATH_HASH
unset KNOWN_CRATE_ORIGIN
Expand Down Expand Up @@ -1430,65 +1429,62 @@ for arg in "$@"; do
elif [[ "$END_OF_OPTIONS" == "no" ]] && [[ "$arg" =~ ^--rw-paths= ]]; then
SANDBOX_RW_PATHS="${arg:11}"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "--$PROJECT_NAME:help" ]] || [[ "$arg" == "$PROJECT_NAME:help" ]] ) ; then
COMMAND="help"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "--$PROJECT_NAME:help" ]] || [[ "$arg" == "$PROJECT_NAME:help" ]] ) ; then
if ! [[ "${COMMAND}" ]]; then COMMAND="help"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "--help" ]] || [[ "$arg" == "help" ]] || [[ "$arg" == "-h" ]]) ; then
COMMAND="cargo-help"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "--help" ]] || [[ "$arg" == "help" ]] || [[ "$arg" == "-h" ]]) ; then
if ! [[ "${COMMAND}" ]]; then COMMAND="cargo-help"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:sandbox-run" ]] || [[ "$arg" == "sandbox-run" ]] ); then
COMMAND="sandbox-run"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:sandbox-run" ]] || [[ "$arg" == "sandbox-run" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="sandbox-run"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:seal" ]] || [[ "$arg" == "seal" ]] ); then
COMMAND="seal"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:seal" ]] || [[ "$arg" == "seal" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="seal"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:disable" ]] || [[ "$arg" == "disable" ]] ); then
COMMAND="disable"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:disable" ]] || [[ "$arg" == "disable" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="disable"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:enable" ]] || [[ "$arg" == "enable" ]] ); then
COMMAND="enable"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:enable" ]] || [[ "$arg" == "enable" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="enable"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:verify" ]] || [[ "$arg" == "verify" ]] ); then
COMMAND="verify"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:verify" ]] || [[ "$arg" == "verify" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="verify"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:owners" ]] || [[ "$arg" == "owners" ]] ); then
COMMAND="list-owners"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:owners" ]] || [[ "$arg" == "owners" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="list-owners"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:files" ]] || [[ "$arg" == "files" ]] ); then
COMMAND="list-seal-files"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:files" ]] || [[ "$arg" == "files" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="list-seal-files"; fi
#elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:bash-embedable" ]] || [[ "$arg" == "bash-embedable" ]] ); then
# COMMAND="generate-bash-embedable"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:own" ]] || [[ "$arg" == "own" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="own"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:own" ]] || [[ "$arg" == "own" ]] ); then
COMMAND="own"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:disown" ]] || [[ "$arg" == "disown" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="disown"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:disown" ]] || [[ "$arg" == "disown" ]] ); then
COMMAND="disown"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:distrust" ]] || [[ "$arg" == "distrust" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="distrust"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:distrust" ]] || [[ "$arg" == "distrust" ]] ); then
COMMAND="distrust"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:init" ]] || [[ "$arg" == "init" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="init"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:init" ]] || [[ "$arg" == "init" ]] ); then
COMMAND="init"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:uninit" ]] || [[ "$arg" == "uninit" ]] ) ; then
if ! [[ "${COMMAND}" ]]; then COMMAND="uninit"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:uninit" ]] || [[ "$arg" == "uninit" ]] ) ; then
COMMAND="uninit"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:identity" ]] || [[ "$arg" == "identity" ]] ); then
COMMAND="identity"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:identity" ]] || [[ "$arg" == "identity" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="identity"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "--$PROJECT_NAME:version" ]] || [[ "$arg" == "--version" ]] ); then
COMMAND="version"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "--$PROJECT_NAME:version" ]] || [[ "$arg" == "--version" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="version"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "--$PROJECT_NAME:legal" ]] || [[ "$arg" == "--legal" ]] ); then
COMMAND="legal"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "--$PROJECT_NAME:legal" ]] || [[ "$arg" == "--legal" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="legal"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:edit" ]] || [[ "$arg" == "edit" ]] ); then
COMMAND="edit"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:edit" ]] || [[ "$arg" == "edit" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="edit"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && ( [[ "$arg" == "$PROJECT_NAME:done" ]] || [[ "$arg" == "done" ]] ); then
COMMAND="done"
elif [[ "$END_OF_OPTIONS" == "no" ]] && ! [[ "${COMMAND}" ]] && ( [[ "$arg" == "$PROJECT_NAME:done" ]] || [[ "$arg" == "done" ]] ); then
if ! [[ "${COMMAND}" ]]; then COMMAND="done"; fi
elif [[ "$END_OF_OPTIONS" == "no" ]] && [[ "$arg" == "--$PROJECT_NAME:end" ]]; then
END_OF_OPTIONS="yes"
Expand All @@ -1515,7 +1511,9 @@ if ! [[ "${CARGO_PATH-}" ]]; then
}
fi
if [[ "$COMMAND" == "cargo-help" ]]; then
debug "Carnet command selected was '$COMMAND'. If empty, this means that this is a direct cargo pass though.";
if [[ "$COMMAND" == "cargo-help" ]] || [[ "$#" -eq 0 ]]; then
# TODO sandbox
"$CARGO_PATH" "help"
printf "%s\n\n" "See '$PROJECT_NAME $PROJECT_NAME:help' or '$PROJECT_NAME --$PROJECT_NAME:help' for more information about options and commands that are specific to carnet."
Expand Down Expand Up @@ -1738,12 +1736,15 @@ if [[ "$COMMAND" ]]; then
KNOWN_CRATE_PATH="."
locate_known_crate_from_the_inside_and_set_up_global_variables
crate_root="${UNHANDLED_NON_OPTIONS[0]:-.}"
if ! [[ -d "$crate_root" ]]; then
fatal "'$crate_root' is not a directory"
fi
if ! [[ -f "$crate_root/Cargo.toml" ]]; then
fatal "'$crate_root' doesn't seem to be a rust crate (no Cargo.toml)"
warn "'$crate_root' doesn't seem to be a rust crate (no Cargo.toml). Proceeding anyway."
fi
initialize_crate "${UNHANDLED_NON_OPTIONS[0]:-.}"
trust_crate "${UNHANDLED_NON_OPTIONS[0]:-.}"
own_crate "${UNHANDLED_NON_OPTIONS[0]:-.}"
initialize_crate "$crate_root"
trust_crate "$crate_root"
own_crate "$crate_root"
elif [[ "$COMMAND" == "uninit" ]]; then
KNOWN_CRATE_PATH="."
locate_known_crate_from_the_inside_and_set_up_global_variables
Expand Down Expand Up @@ -1821,15 +1822,16 @@ else
sandbox "$CARGO_PATH" "${FILTERED_ARGS[@]}" || exit "$?"
if ! [[ "${UNHANDLED_NON_OPTIONS[1]-}" ]] || ! [[ -f "${UNHANDLED_NON_OPTIONS[1]}/Cargo.toml" ]]; then
fatal "Your new crate has been successfully setup by cargo, \
but carnet could not initialize it automatically because \
it couldn't find the new directory \
'${UNHANDLED_NON_OPTIONS[1]-}'. You can initialize your \
crate manually by running $PROJECT_NAME carnet:init inside your crate."
fatal "Carnet has failed to setup your new crate properly. You can try to use cargo directly and then run $PROJECT_NAME carnet:init manually inside your new crate. Please consider reporting this issue if you can reproduce it."
Please consider reporting this issue.
fi
initialize_crate "${UNHANDLED_NON_OPTIONS[1]}"
trust_crate "${UNHANDLED_NON_OPTIONS[1]}"
own_crate "${UNHANDLED_NON_OPTIONS[1]}"
if ! [[ "${UNHANDLED_NON_OPTIONS[1]-}" ]] || ! [[ -d "${UNHANDLED_NON_OPTIONS[1]}/.carnet" ]]; then
fatal "Carnet has failed to setup your new crate properly. Try to run $PROJECT_NAME carnet:init manually inside your new crate. Please consider reporting this issue if you can reproduce it."
fi
elif [[ "${UNHANDLED_NON_OPTIONS[0]-}" == "version" ]]; then
echo "$PROJECT_NAME $PROJECT_VERSION ($PROJECT_DATE NCA)"
sandbox "$CARGO_PATH" version
Expand All @@ -1838,7 +1840,7 @@ else
printf "%s\n\n" "See '$PROJECT_NAME $PROJECT_NAME:help' or '$PROJECT_NAME --$PROJECT_NAME:help' for more information about the options and commands that are specific to Carnet."
else
if ! [[ "${KNOWN_CRATE_STATE-}" ]] || [[ "$KNOWN_CRATE_STATE" != "found" ]]; then
fatal "Could not find a registered crate in '$PWD' or any parent directory"
fatal "Could not find a registered crate in current directory or any parent directory.\n See 'carnet new' and 'carnet init' commands."
fi
if [[ "$DISABLE_AUTOVERIFICATION" != "yes" ]]; then
verify
Expand Down
2 changes: 1 addition & 1 deletion tests/carnet-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ else
for case in "cases/"*; do
case_name="$(basename "$case")"
if [[ "${case_name::12}" == "0000-ignored" ]] && [[ "${TEST_IGNORED-}" == "" ]]; then
step "ignored" "$case_name"
step "ignored" "$case_name (Set env TEST_IGNORED to 'yes' to test)"
else
run_case "$case"
fi
Expand Down

0 comments on commit 0a21b72

Please sign in to comment.