Repository navigation
linux: keep the whole Unix socket path from /proc/net/unix - #385
Merged
Merged
Conversation
Member
|
When testing this, I found that TABs may appear in unix socket path, which will be truncated as well. Maybe we need a better way to handle the fragile text parsing. |
get_unix() split each line on blanks, TABs and ':' and used only the 8th field as the path, so a socket bound to "/tmp/my sock" was shown as "/tmp/my", and one with a ':' or a TAB in its name was cut there. The kernel prints the path last, after a single blank, up to the newline, so take it from the line as is and split only the fields before it.
Ar-maan05
force-pushed
the
unix-path-with-space
branch
from
November 9, 2026 14:27
2e9c5dd to
b94c50f
Compare
Contributor
Author
|
good catch, thanks! get_fields() always treats TAB as a seperator so the eb[] route couldnt cover it. the kernel prints the path last after a single space, so i changed it to just take everything after the 7th field up to the newline, and only split the fields before that. tabs, double spaces and ':' all come through now, and the test uses a path with all three. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
unix socket paths with a space or a
:get cut off on linux:get_unix()splits the/proc/net/unixline on blanks and:, so the path is only the first word. the kernel prints the path last after one blank, so the fix takes it from the line as is (blanks, TABs,:all kept) and only splits the feilds before it.added
case-20-ux-socket-path-space.bashusing a path with blanks, a TAB and a:. it fails before and passes after,make checkis clean except LTlock, which fails on my machine without the change too.