-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
lo IPClocalhost IPC primitives and APIslocalhost IPC primitives and APIsmacos_relatedgotta tailor to them job bros i supposegotta tailor to them job bros i supposenon-linuxfor those who prefer walled gardens (macos, windows, etc.)for those who prefer walled gardens (macos, windows, etc.)
Description
From copilot's review in #406.
I'm adding this as a follow up since what we have in #406 is more
then good enough imo for a first macos-support attempt and given that
the .ipc._shm subsys is currently undocumented and still considered
somewhat unrefined/experimental.
_shorten_key_for_macos() ignores the provided prefix/suffix
when len(key) <= max_len (it returns key unchanged). This causes
collisions on macOS in _make_token() because shm_name,
shm_first_index_name, and shm_last_index_name can become
identical for “short” keys, and it also drops the prefix for
open_shm_list(). Adjust the early-return logic to include `prefix
- key + suffix
and ensure the length check accounts for the leading '/' added bySharedMemory` on POSIX as well as the prefix/suffix
lengths.
# Account for the leading '/' added by POSIX SharedMemory names
usable_len: int = max_len - 1
full_key: str = f"{prefix}{key}{suffix}"
if len(full_key) <= usable_len:
return full_key
_hash: str = hashlib.sha256(
key.encode()
).hexdigest()
hash_len: int = (
usable_len
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lo IPClocalhost IPC primitives and APIslocalhost IPC primitives and APIsmacos_relatedgotta tailor to them job bros i supposegotta tailor to them job bros i supposenon-linuxfor those who prefer walled gardens (macos, windows, etc.)for those who prefer walled gardens (macos, windows, etc.)