-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
The socket has a different name depending on how the path was referenced when dtach was invoked
$ dtach -n /home/sellout/dtach-abs sleep 100
$ dtach -n ./dtach-cur sleep 200
$ dtach -n dtach-rel sleep 300
$ ls ~/dtach-*
/home/sellout/dtach-abs /home/sellout/dtach-cur /home/sellout/dtach-rel
$ lsof -U | grep dtach
dtach 3206397 sellout 3u unix 0x0000000000000000 0t0 68280105 /home/sellout/dtach-abs type=STREAM (LISTEN)
dtach 3206490 sellout 3u unix 0x0000000000000000 0t0 68280852 ./dtach-cur type=STREAM (LISTEN)
dtach 3212205 sellout 3u unix 0x0000000000000000 0t0 68286170 dtach-rel type=STREAM (LISTEN)
$
The current behavior isn’t very helpful when using lsof
to solve #2. If you ran dtach
with a relative socket name in different directories, you get no indication where each socket lives, so you can’t find it to attach to.
So, what I’d like to see is
$ dtach -n /home/sellout/dtach-abs sleep 100
$ dtach -n ./dtach-cur sleep 200
$ dtach -n dtach-rel sleep 300
$ lsof -U | grep dtach
dtach 3206397 sellout 3u unix 0x0000000000000000 0t0 68280105 /home/sellout/dtach-abs type=STREAM (LISTEN)
dtach 3206490 sellout 3u unix 0x0000000000000000 0t0 68280852 /home/sellout/dtach-cur type=STREAM (LISTEN)
dtach 3212205 sellout 3u unix 0x0000000000000000 0t0 68286170 /home/sellout/dtach-rel type=STREAM (LISTEN)
$
Another variant is using the same relative socket name in different directories, because then you can’t tell them apart in the lsof output.
Another way to potentially help with #2 is to include (a prefix of) the command
$ lsof -U | grep dtach
dtach 3206397 sellout 3u unix 0x0000000000000000 0t0 68280105 /home/sellout/dtach-abs (sleep 1…) type=STREAM (LISTEN)
dtach 3206490 sellout 3u unix 0x0000000000000000 0t0 68280852 /home/sellout/dtach-cur (sleep 2…) type=STREAM (LISTEN)
dtach 3212205 sellout 3u unix 0x0000000000000000 0t0 68286170 /home/sellout/dtach-rel (sleep 3…) type=STREAM (LISTEN)
$
(with …
being used to truncate if the command would push it over the name length limit)
Metadata
Metadata
Assignees
Labels
No labels