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

launcher: add fix for long socket paths #203

Merged
merged 4 commits into from
Nov 17, 2022

Conversation

better0fdead
Copy link
Contributor

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

@better0fdead better0fdead marked this pull request as draft October 27, 2022 10:32
@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch 3 times, most recently from aa8e215 to 74650ce Compare November 2, 2022 11:35
@@ -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).
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed comment

Copy link
Member

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

Copy link
Contributor Author

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

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch 3 times, most recently from 544f258 to ea2622c Compare November 3, 2022 15:49
@better0fdead better0fdead requested a review from 0x501D November 3, 2022 15:49
@better0fdead better0fdead marked this pull request as ready for review November 3, 2022 15:49
@0x501D
Copy link
Member

0x501D commented Nov 10, 2022

Please, rebase with master to resolve conflicts.

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch from ea2622c to 7590590 Compare November 14, 2022 15:03
@better0fdead
Copy link
Contributor Author

Please, rebase with master to resolve conflicts.

Done

@better0fdead better0fdead marked this pull request as draft November 15, 2022 09:18
@better0fdead better0fdead reopened this Nov 15, 2022
@better0fdead
Copy link
Contributor Author

better0fdead commented Nov 15, 2022

blocked by issue
upd. Fixed

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch from 7590590 to 004e6f4 Compare November 15, 2022 11:45
@better0fdead better0fdead marked this pull request as ready for review November 15, 2022 12:02
@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch from 004e6f4 to 4964bb1 Compare November 15, 2022 12:02
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",
Copy link
Member

@0x501D 0x501D Nov 15, 2022

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// 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",
Copy link
Member

@0x501D 0x501D Nov 15, 2022

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch 2 times, most recently from 9a99126 to 7e6df56 Compare November 16, 2022 03:33
@better0fdead better0fdead requested a review from 0x501D November 16, 2022 03:33
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))
Copy link
Member

@0x501D 0x501D Nov 16, 2022

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'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch 2 times, most recently from 2a64900 to 6b91958 Compare November 16, 2022 19:17
Copy link
Member

@0x501D 0x501D left a comment

Choose a reason for hiding this comment

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

LGTM

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch 2 times, most recently from ac7d844 to 6078e66 Compare November 16, 2022 21:30
Copy link
Collaborator

@LeonidVas LeonidVas left a 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 ...

@LeonidVas
Copy link
Collaborator

Add a description of the changes to the CHANGELOG.

@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch from 6078e66 to 31fafd4 Compare November 17, 2022 09:11
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
@better0fdead better0fdead force-pushed the better0fdead/gh-124-socket-path branch from 31fafd4 to ddb9b08 Compare November 17, 2022 10:45
@LeonidVas LeonidVas merged commit 26c294a into master Nov 17, 2022
@LeonidVas LeonidVas deleted the better0fdead/gh-124-socket-path branch November 17, 2022 11:15
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.

Long console socket path.
4 participants