5long / p3wm

Three-way merge .pacnew file
ISC License
13 stars 4 forks source link

Suggestion: use mktemp for the creation of the temporary directory #4

Closed CubeTheThird closed 2 years ago

CubeTheThird commented 4 years ago

While unlikely, there is a slight chance that the creation of the temporary directory could fail, due to the way it's somewhat hard-coded. It seems that mktemp is already being used to create temporary files, however (IMO) this should equally be used to create the directory too.

This could be done simply as: tmpdir=$(mktemp -d)

5long commented 2 years ago

I can see the "better be safe than sorry" reasoning behind this suggestion. But there's also a small setback: every time p3wm is launched, there will be a randomized suffix appended to the path like /tmp/p3wm-DEADBEEF which might make it harder for a user to find the temporary files on their own.

Looking at my own /tmp folder right now: tmux, by default, stores its socket at /tmp/tmux-$UID. That looks like a good middle ground to me: easily recognizable, less chance to conflict.

Fix commited in 6e9ef11

5long commented 2 years ago

Fix included in release 0.7.0