Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Pass arguments beginning with dash (-) to channel programs #9058

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/zfs/zfs_main.c
Expand Up @@ -7627,6 +7627,9 @@ zfs_do_channel_program(int argc, char **argv)
boolean_t sync_flag = B_TRUE, json_output = B_FALSE;
zpool_handle_t *zhp;

/* fix option scanning behavior so -args are passed to the channel program*/
putenv("POSIXLY_CORRECT=1");

/* check options */
while ((c = getopt(argc, argv, "nt:m:j")) != -1) {
switch (c) {
Expand Down
Expand Up @@ -25,6 +25,6 @@ verify_runnable "global"

log_assert "Passing arguments to lua programs should work correctly."

log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.args_to_lua.zcp foo bar
log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.args_to_lua.zcp -foo bar

log_pass "Passing arguments to lua programs should work correctly."
Expand Up @@ -19,7 +19,7 @@ arg = ...
argv = arg["argv"]

assert(#argv == 2)
assert(argv[1] == "foo")
assert(argv[1] == "-foo")
assert(argv[2] == "bar")

return