You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ shtuff as /foo
Traceback (most recent call last):
File "/home/jeremy/.local/bin/shtuff", line 8, in <module>
sys.exit(main())
File "/home/jeremy/.local/lib/python3.9/site-packages/shtuff.py", line 83, in main
func(**args)
File "/home/jeremy/.local/lib/python3.9/site-packages/shtuff.py", line 93, in shtuff_as
with open(pid_file, 'w') as f:
PermissionError: [Errno 13] Permission denied: '/foo.pid'
Note how it's trying to create a foo.pid directory at the root of my filesystem. That shouldn't happen!
The problem is that we don't do any escaping of the filename when calling get_pid_file:
Check this out:
Note how it's trying to create a
foo.pid
directory at the root of my filesystem. That shouldn't happen!The problem is that we don't do any escaping of the filename when calling
get_pid_file
:vs:
I think the fix is to have
get_pid_file
do some escaping of the name. The simplest option may be base64 encode the whole thing? Looking through https://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename, https://stackoverflow.com/a/295150 mentions this, and warns to be careful to avoid the/
character.The text was updated successfully, but these errors were encountered: