-
Notifications
You must be signed in to change notification settings - Fork 12
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
launcher: add fix for long socket paths #203
Conversation
aa8e215
to
74650ce
Compare
cli/connector/connector.go
Outdated
@@ -37,6 +39,17 @@ type Connector interface { | |||
|
|||
// Connect connects to the tarantool instance according to options. | |||
func Connect(opts ConnectOpts) (Connector, error) { | |||
// It became common that address is longer than 140 symbols(limit). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux sun_path is 108 bytes length.
Anyway we should check the minimal length and throw an error if opts.Address > 108.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That patch allows us to use opts.Address longer than sun_path limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose this:
opts.Address = "/tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
opts.Address = "./" + filepath.Base(opts.Address)
pts.Address length will be > 108
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed comments prior to your message
544f258
to
ea2622c
Compare
Please, rebase with master to resolve conflicts. |
ea2622c
to
7590590
Compare
Done |
blocked by issue |
7590590
to
004e6f4
Compare
004e6f4
to
4964bb1
Compare
cli/connector/connector.go
Outdated
os.Chdir(filepath.Dir(opts.Address)) | ||
opts.Address = "./" + filepath.Base(opts.Address) | ||
if len(opts.Address) > 108 { | ||
return nil, fmt.Errorf("socket name is longer than 106 symbols: %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constant var for limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cli/running/instance.go
Outdated
// e.g foo/bar/123.sock -> ./123.sock | ||
if inst.consoleSocket != "" { | ||
if len("./"+filepath.Base(inst.consoleSocket)) > 108 { | ||
return fmt.Errorf("socket name is longer than 106 symbols: %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constant var for limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
108 on Linux, 104 on Mac OS AFAIR. But that's with leading '\0'
. So 107 and 103.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also a remark regarding using 108th and 104th byte in tarantool/tarantool#4634 and links regarding Mac OS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from unix(7):
The length of the pathname, including the terminating null byte, should not exceed the size of sun_path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
9a99126
to
7e6df56
Compare
cli/connector/connector.go
Outdated
opts.Address = "./" + filepath.Base(opts.Address) | ||
if len(opts.Address) > maxSocketPath { | ||
return nil, fmt.Errorf("socket name is longer than %d symbols: %s", | ||
maxSocketPath-2, filepath.Base(opts.Address)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(opts.Address) -> len(opts.Address) + 1 (for '\0')
maxSocketPath-3 -> "./" + '\0'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2a64900
to
6b91958
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ac7d844
to
6078e66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for the patchset.
I don't (and will not) review the code, and I think a review from Pavel is sufficient in this case. Please edit the commit messages and I will merge PR.
"cartridge: update to 2.12.3" -> "cartridge-cli: bump 2.12.3 version"
- it would be nice to describe the reason for updating the submodule in the commit message
"CI: add explicit license for config package" -> "ci: ..."
https://github.com/tarantool/tarantool/wiki/Code-review-procedure#commit-message
... started from lowercase letter ...
Commit message should fit 72 symbols line width ...
Add a description of the changes to the CHANGELOG. |
6078e66
to
31fafd4
Compare
Now relative path is used instead of real for console socket. It is used to prevent console socket path from being too long. Part of #124
Now relative path is used instead of real for console socket. It is used to prevent console socket path from being too long. Closes #124
Added override of license for robfig/config since it is not correctly set in package itself. Part of #124
Updated fork of cartridge-cli to 2.12.3. Updated go.sum/mod and test due to new behaviour of cartridge. Patch to reduce socket path length was introduced with 2.12.3 which should allow to use longer socket path in tt. Part of #124
31fafd4
to
ddb9b08
Compare
Now relative path is used instead of real for console socket.
It is used to prevent console socket path from being too long.
Closes #124