diff --git a/src/cmd/flux-kvs.c b/src/cmd/flux-kvs.c index a53607a7e201..4076c94a1f1d 100644 --- a/src/cmd/flux-kvs.c +++ b/src/cmd/flux-kvs.c @@ -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); diff --git a/t/t1000-kvs.t b/t/t1000-kvs.t index 4214403ad770..f432e6b29011 100755 --- a/t/t1000-kvs.t +++ b/t/t1000-kvs.t @@ -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 <output &&