Fixed ENAMETOOLONG error in setup_console_socket #2914
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In reference to the error found here: #2910
sun_path has a max length of 108 bytes: https://man7.org/linux/man-pages/man7/unix.7.html
And including the absolute path name can make the resulting address of the socket path too long for sun_path.
Quick solution, move to the container_dir first, that way the sun_path is always just as long as the name "console-socket" itself, and doesn't break depending on the length of the runtime filepath.
I also wrapped this update in code that saves the previous directory and moves back to it afterwords. I personally doubt this is necessary and may simply be wasted clock cycles. Since we tend to use absolute path names in general, both to navigate and to access specific links. Nevertheless, I didn't want to make that call. If repositioning the directory afterwards is not necessary that could certainly be cleaned out. Cargo test passes in either case.