[pass] [PASS][PATCH] Renamed filelock for clarity. (new feature passmenu multi-clip)

mitfree lists at ampling.com
Wed Jul 20 03:09:49 CEST 2016


> On Tue, Jul 19, 2016, 19:36 mitfree <lists at ampling.com> wrote:
> 
> +( mktemp -d "/tmp/passmenu."$userID".XXXXXXXXXX"."$$".lock >/dev/null
> 2>&1 && cleanup=True ||
>    { echo >&2 ":: Unable to make a filelock."; exit 1; } )
..
>     +    rmdir /tmp/passmenu.*.*."$$".lock >/dev/null 2>&1
..
>     +    rmdir /tmp/passmenu."$userID".* >/dev/null 2>&1 ||


Quoting Marcos Alano (2016-07-19 18:45:03)
> Could be a file instead of a folder.


One of the nice things about rmdir is that it will error on non-empty.
Since there is a bash variable in the basename, I was extra careful about
unintentionally removing the wrong file. We want to prevent the unlikely situation
where through some unforeseen bash bug an environmental variable could be pass '../'

Even though I also hard code '/tmp/passmenu.', I'm just not positive
that it couldn't be escaped, sometime in the future. That's why I went
with a directory.


More information about the Password-Store mailing list