Skip to content

Commit

Permalink
Merge pull request #1452 from chu11/issue1449
Browse files Browse the repository at this point in the history
cmd/flux-kvs: Fix dir -R corner case
  • Loading branch information
garlick authored Apr 12, 2018
2 parents 81eef20 + 941bfb0 commit 37499f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cmd/flux-kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,10 @@ static void dump_kvs_dir (const flux_kvsdir_t *dir, int maxcol,
if (!(f = flux_kvs_lookupat (h, FLUX_KVS_READDIR, key, rootref))
|| flux_kvs_lookup_get_dir (f, &ndir) < 0)
log_err_exit ("%s", key);
dump_kvs_dir (ndir, maxcol, Ropt, dopt);
if (flux_kvsdir_get_size (ndir) == 0)
printf ("%s.\n", key);
else
dump_kvs_dir (ndir, maxcol, Ropt, dopt);
flux_future_destroy (f);
} else
printf ("%s.\n", key);
Expand Down
7 changes: 7 additions & 0 deletions t/t1000-kvs.t
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ $DIR.d.
EOF
test_cmp expected output
'
test_expect_success 'kvs: dir -R lists subdir' '
flux kvs dir -R $DIR | sort >output &&
cat >expected <<EOF &&
$DIR.d.
EOF
test_cmp expected output
'
test_expect_success 'kvs: dir -R DIR' '
flux kvs put --json $DIR.a=42 $DIR.b=3.14 $DIR.c=foo $DIR.d=true $DIR.e="[1,3,5]" $DIR.f="{\"a\":42}" &&
flux kvs dir -R $DIR | sort >output &&
Expand Down

0 comments on commit 37499f8

Please sign in to comment.