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

v0.40.18 tries to open empty string as privilege file if not explicitly provided #3865

Closed
jmeickle opened this issue Jul 19, 2022 · 6 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@jmeickle
Copy link

I tried setting up dolt server today and ran into some hiccups with the new privilege file settings. At first because the docs are now out of date I hit #3859, but also I believe I ran into an unrelated bug:

If I have either none of these variables in the YAML and fall back to defaults:

or these two (but not privilege_file, by commenting it out):

data_dir: /var/lib/doltdb/databases
cfg_dir: /var/lib/doltdb/databases/.doltcfg
#privilege_file: /var/lib/doltdb/databases/.doltcfg/privileges.db

Then on the sql-client side, creating a user results in this this confusing error message:

mysql> CREATE USER 'test2' IDENTIFIED BY 'foo';
Error 1105: open : no such file or directory

The user is created and shows up in mysql.user, but is not persisted (disappears on startup). I got curious what was happening and investigated it with strace:

[pid  1920] write(2, "2022-07-19T23:31:16Z TRACE [conn"..., 1542022-07-19T23:31:16Z TRACE [conn 1] beginning execution {connectTime=2022-07-19T23:31:13Z, connectionDb=, query=CREATE USER 'test2' IDENTIFIED BY 'foo';}
) = 154
[pid  1920] write(2, "2022-07-19T23:31:16Z TRACE [conn"..., 1602022-07-19T23:31:16Z TRACE [conn 1] beginning new transaction {connectTime=2022-07-19T23:31:13Z, connectionDb=, query=CREATE USER 'test2' IDENTIFIED BY 'foo';}
) = 160
[pid  1920] openat(AT_FDCWD, "", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0777) = -1 ENOENT (No such file or directory)
[pid  1920] write(2, "2022-07-19T23:31:16Z WARN [conn "..., 1932022-07-19T23:31:16Z WARN [conn 1] error running query {connectTime=2022-07-19T23:31:13Z, connectionDb=, error=open : no such file or directory, query=CREATE USER 'test2' IDENTIFIED BY 'foo';}
) = 193
[pid  1920] write(8, ")\0\0\1\377Q\4#HY000open : no such file"..., 45) = 45
[pid  1920] read(8, "\1\0\0\0\16", 16384) = 5
[pid  1920] write(8, "\7\0\0\1", 4)     = 4
[pid  1920] write(8, "\0\0\0\0\0\0\0", 7) = 7
[pid  1920] read(8, "\1\0\0\

So it's actually opening a string "" which is also why the open : message looks odd.

Explicitly providing the privilege_file setting worked as expected: users can be created, there is no error message, and they persist on server restart.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jul 19, 2022

@jcor11599 will get on this. I think he fixed it here: #3859

But he can confirm.

@jycor
Copy link
Contributor

jycor commented Jul 19, 2022

I just fixed: #3859 and that's in the newest release v0.40.19, but that doesn't explain the behavior @Eronarn is getting now.

It appears there is a bug with persisting privileges when they are specified in a config.yaml

I'll start working on fixing it now.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jul 20, 2022

@jcor11599 also update the docs.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jul 20, 2022

I think these are the two places:

  1. https://docs.dolthub.com/sql-reference/server/access-management
  2. https://docs.dolthub.com/cli-reference/cli#dolt-sql-server

@Eronarn are these the out of date docs you are referring to or did you hit another one?

@jmeickle
Copy link
Author

Yep that's correct - hit the other bug you fixed trying the first set of steps, then hit the second bug trying to use the config file as-is.

I checked out your PR which is how I found out what the "new" config vars should be; but I didn't look into the Go code deeply to figure out why it was getting an empty string :(

@fulghum fulghum added bug Something isn't working documentation Improvements or additions to documentation labels Jul 20, 2022
@jycor
Copy link
Contributor

jycor commented Jul 20, 2022

Fix for this issue is merged to main and should be available next release (probably soon).

There are other unrelated changes I'm close to finishing that will affect the docs, so I'll update the docs once those are done.

@jycor jycor closed this as completed Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants