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

cmd/flux-kvs: Update dir and ls usage #1444

Merged
merged 4 commits into from
Apr 11, 2018
Merged

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Apr 10, 2018

With the dir and ls commands in flux-kvs, if a user specifies a
namespace prefix without a key, assume the user desires the root
(i.e. ".") directory within that namespace.

Update/adjust unit tests appropriately.

Fixes #1434

@garlick
Copy link
Member

garlick commented Apr 10, 2018

Er. not sure this looks right:

$ flux kvs namespace-create foo
$ flux kvs put ns:foo/a=b
$ flux kvs dir ns:foo/
ns:foo/..a = b

&& (ptr = strchr (nkey, '/'))) {
/* No key suffix, decorate with default '.' */
if (*(ptr + 1) == '\0')
strcat (nkey, ".");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you decorate with . here, is that resulting in an extra . when the keys are actually printed in dir? e.g. I'm seeing:

$ flux kvs put ns:foo/bar=none
$ flux kvs dir ns:foo/
ns:foo/..bar = none

The /.. might confusing people. I would assume we'd want the same output as we used to put the key in the first place, i.e. ns:foo/bar = none -- leading dots stripped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as you are in here, I wonder if a fix for this issue would also fix #1391? For some reason I find this awkward:

$ flux kvs dir resource. 
resource..hwloc.

Possibly just stripping all trailing . from "key" will help?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops sorry, @garlick beat me to it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that is issue #1391. I was going to fix it separately.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@f4e0b7e). Click here to learn what that means.
The diff coverage is 93.75%.

@@            Coverage Diff            @@
##             master    #1444   +/-   ##
=========================================
  Coverage          ?   78.76%           
=========================================
  Files             ?      163           
  Lines             ?    30208           
  Branches          ?        0           
=========================================
  Hits              ?    23792           
  Misses            ?     6416           
  Partials          ?        0
Impacted Files Coverage Δ
src/cmd/flux-kvs.c 81.26% <93.75%> (ø)

@chu11
Copy link
Member Author

chu11 commented Apr 10, 2018

@garlick The double period is issue #1391, was going to fix that issue separately. But could merge in here if that's what's desired.

@garlick
Copy link
Member

garlick commented Apr 10, 2018 via email

chu11 added 4 commits April 10, 2018 19:35
With the dir and ls commands in flux-kvs, if a user specifies a
namespace prefix without a key, assume the user desires the root
(i.e. ".") directory within that namespace.

Update/adjust unit tests appropriately.

Fixes flux-framework#1434
Fix output corner cases where double periods or errant additional
period could be output.

Fixes flux-framework#1391
Also adjust older tests to remove double periods.
@chu11
Copy link
Member Author

chu11 commented Apr 11, 2018

Just pushed update w/ period output corner case fixes. It fixes both the double period output case an an extraneous period output corner case that I found along the way. Lots of unit tests added.

Also added in dumb patch in which I remove a duplicate test.

@chu11
Copy link
Member Author

chu11 commented Apr 11, 2018

hit a

PASS: t4000-issues-test-driver.t 3 - t0821-kvs-segfault.sh

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

which I think is #1311. Restarted builder.

@garlick
Copy link
Member

garlick commented Apr 11, 2018

Better!

$ flux kvs put ns:foo/a=b
$ flux kvs dir ns:foo/
ns:foo/a = b
$ flux kvs dir ns:foo/.
ns:foo/a = b

Hmm, what about this one?

$ flux kvs dir ns:foo/..
ns:foo/..a = b

@chu11
Copy link
Member Author

chu11 commented Apr 11, 2018

I would say this is a different bug, where we have to decide if we want to "normalize" a users input before output. We didn't do that before.

>flux kvs ls -R resource......hwloc...xml
resource......hwloc...xml:
0    1    2    3

Is this a change we want to do? I think that it should be different issue though.

@chu11
Copy link
Member Author

chu11 commented Apr 11, 2018

I'm going to create a new issue for the above case, as I feel its separate from this PR and has a few things to consider.

@garlick
Copy link
Member

garlick commented Apr 11, 2018

Sounds good. I'll go ahead and merge this. Thanks!

@garlick garlick merged commit 81eef20 into flux-framework:master Apr 11, 2018
@grondo grondo mentioned this pull request May 10, 2018
@chu11 chu11 deleted the issue1434 branch June 5, 2021 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kvs: user facing commands may need fine tuning for namespaces
4 participants