-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Description
After detaching from a session, ATCH_SESSION remains in the shell environment. The self-attach guard in attach_main compares this stale value against the target socket path, blocking all subsequent attach attempts with:
atch: cannot attach to session 'X' from within itself
Reproduction
atch -c session1→ detach (Ctrl+)atch list→ shows session1atch -a session1→ error "cannot attach from within itself"unset ATCH_SESSION→ attach works again
Root cause
The guard relies solely on matching the ATCH_SESSION environment variable against the socket path. It does not verify whether the current process is actually a descendant of the session's shell process.
Suggested fix
Replace the env-var-only check with a PID ancestry walk: read the session's shell PID from a .ppid file written by the master, then walk getppid() upward to confirm actual ancestry before blocking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels