emersion / emersion/slurp

fails to acquire lock if `WAYLAND_DISPLAY` contains a `/`

Open
#188 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.3k
Forks
75
PR merge metrics
No merged PRs in 30d

Description

```sh
$ slurp
failed to open lock file
$ XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR/$(dirname $WAYLAND_DISPLAY) WAYLAND_DISPLAY=$(basename $WAYLAND_DISPLAY) slurp
# (works)
```

relevant environment:
```sh
$ env | egrep 'WAY|XDG_'
SWAYSOCK=/run/user/colin/sway/sway-ipc.sock
WAYLAND_DISPLAY=wl/wayland-1
XDG_CURRENT_DESKTOP=sway
XDG_DATA_DIRS=/etc/profiles/per-user/colin/share:/run/current-system/sw/share
XDG_RUNTIME_DIR=/run/user/colin
XDG_SESSION_TYPE=wayland
XDG_CONFIG_DIRS=/etc/xdg:/etc/profiles/per-user/colin/etc/xdg:/run/current-system/sw/etc/xdg
XDG_CACHE_DIR=/home/colin/.cache
XDG_DESKTOP_DIR=/home/colin/.xdg/Desktop
XDG_DOCUMENTS_DIR=/home/colin/dev
XDG_DOWNLOAD_DIR=/home/colin/tmp
XDG_MUSIC_DIR=/home/colin/Music
XDG_PHOTOS_DIR=/home/colin/Pictures/Photos
XDG_PICTURES_DIR=/home/colin/Pictures
XDG_PUBLICSHARE_DIR=/home/colin/.xdg/Public
XDG_SCREENSHOTS_DIR=/home/colin/Pictures/Screenshots
XDG_TEMPLATES_DIR=/home/colin/.xdg/Templates
XDG_VIDEOS_DIR=/home/colin/Videos
```

particularly:
```sh
$ echo WAYLAND_DISPLAY
wl/wayland-1
$ tree $XDG_RUNTIME_DIR
/run/user/colin
├── chg
├── dbus
│   └── bus
├── keyring
│   └── control
├── pipewire
│   ├── pipewire-0
│   ├── pipewire-0.lock
│   ├── pipewire-0-manager
│   └── pipewire-0-manager.lock
├── pulse
│   ├── native
│   └── pid
├── ssh-agent
│   └── agent
├── sway
│   └── sway-ipc.sock
└── wl
├── slurp-wayland-1.lock
├── wayland-1
└── wayland-1.lock
```

(that `$XDG_RUNTIME_DIR/wl/slurp-wayland-1.lock` file was created only as part of the 2nd `slurp` invocation, with XDG_RUNTIME_DIR and WAYLAND_DISPLAY modified as appropriate -- not by the bare `slurp` call which failed).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the bare `slurp` command with `WAYLAND_DISPLAY=wl/wayland-1` and compare it with the invocation that adjusts `XDG_RUNTIME_DIR` and `WAYLAND_DISPLAY`. Trace how slurp derives and opens its lock-file path, then verify the fix against the reported `$XDG_RUNTIME_DIR/wl/slurp-wayland-1.lock` layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.