-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
zellij doesn't start in wezterm on M1 mac (ventura) - socket path should not be longer than 104 bytes #2817
Comments
Hey, sorry for the trouble. Does this work if you |
Nono - we should support this. I don't know what's going on here, but I'm suspicious of this hard-coded socket path limitation... @jaeheonji - if I'm not mistaken I think you have a little more context on this verification. Do you have any ideas? |
@jaeheonji - I'm just wondering where the number 108 comes from... |
(just to make sure: no blame or anything! This isn't anyone's fault, just trying to understand) |
I think I misunderstood the history and reviewed it. I guess that whoever created the PR saw the number 108 you mentioned and hard-coded it. However, this is a problem because it is not a value considering a system such as Darwin. I think it's my mistake. I was only focusing the function and logic, so I missed about the issue history. |
No worries @jaeheonji - it happens! Do you know where we can get this number dynamically so it will fit all systems? |
I checked out some documentation and the raw code of the Rust Standard library. First, I found good answers about this topic in stack overflow. Most UNIX-based systems (including macOS) seem to have Then, I was able to check the socket_path magic number defined for each system in This code internally call pub(super) fn sockaddr_un(path: &Path) -> io::Result<(libc::sockaddr_un, libc::socklen_t)> {
// SAFETY: All zeros is a valid representation for `sockaddr_un`.
let mut addr: libc::sockaddr_un = unsafe { mem::zeroed() };
addr.sun_family = libc::AF_UNIX as libc::sa_family_t;
let bytes = path.as_os_str().as_bytes();
if bytes.contains(&0) {
return Err(io::const_io_error!(
io::ErrorKind::InvalidInput,
"paths must not contain interior null bytes",
));
}
// HERE
if bytes.len() >= addr.sun_path.len() {
return Err(io::const_io_error!(
io::ErrorKind::InvalidInput,
"path must be shorter than SUN_LEN",
));
}
...
} And, socket_path can be checked in the libc package as the // libc/src/unix/bsd/mod.rs
pub struct sockaddr_un {
pub sun_len: u8,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104] // THIS
}
// libc/src/unix/linux_like/mod.rs
pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [::c_char; 108] // THIS
} So, I think we can dynamically get the maximum socket_path value for each system by calling |
Yes @jaeheonji - this looks good, thanks for addressing this so fast! I hope this did not stress you too much, I'm not sure why we encountered this here, but this seems very much like an edge case - so I don't think the fix is very urgent. Please make sure to put this under the os interface (I think it's called OsInputOutput but I don't have it in front of me) so that we can mock this up in tests and make it work for other OSs if we need to. If it fails to get the info from libc for some reason, it should not crash and return a None instead, and then we'll do what we did up until now. Makes sense? |
@imsnif Great! then If it's not urgent now, can we handle this problem after doing what we originally wanted to do (plugin web)? |
Yes, definitely! I'll assign this issue for you and let's take care of it after the plugin web. |
Thank you for taking the time to file this issue! Please follow the instructions and fill in the missing parts below the instructions, if it is meaningful. Try to be brief and concise.
In Case of Graphical or Performance Issues
/tmp/zellij-1000/zellij-log
, ie withcd /tmp/zellij-1000/
andrm -fr zellij-log/
(/tmp/
is$TMPDIR/
on OSX)zellij --debug
stty size
, copy the result and attach it in the bug reportPlease attach the files that were created in
/tmp/zellij-1000/zellij-log/
to the extent you are comfortable with.Basic information
zellij --version
: zellij 0.38.2stty size
: 58 101zellij --debug
log: zellij.logCrucially:
uname -av
orver
(Windows): Darwin VWGOAAHL333260 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 arm64List of programs you interact with as,
PROGRAM --version
: output cropped meaningful, for example:wezterm --version
: wezterm 20230712-072601-f4abf8fdFurther information
zellij seems to run fine on Terminal, iterm, and kitty
FWIW, I can't ctrl-q -- I'm stuck with no output:
The text was updated successfully, but these errors were encountered: