libkv icon indicating copy to clipboard operation
libkv copied to clipboard

store/boltdb: Allow paths with no slash at the beginning

Open vishen opened this issue 8 years ago • 1 comments

The following was not working for me because of the way libkv handles the path for BoltDB

kv, err := libkv.NewStore(
	store.BOLTDB,
	[]string{"__boltdbtest"},
	&store.Config{
		Bucket: "boltDBTest",
	},
)

I would get the following error because when libkv attempts to create the BoltDB path: mkdir : no such file or directory - It uses https://godoc.org/path/filepath#Split which can return an empty string for dir.

This PR checks if the dir is not an empty string before calling os.MkdirAll(dir, 0750).

vishen avatar May 05 '17 08:05 vishen

Please sign your commits following these rules: https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work The easiest way to do this is to amend the last commit:

$ git clone -b "master" [email protected]:vishen/libkv.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

GordonTheTurtle avatar May 05 '17 08:05 GordonTheTurtle