[pass] [PASS][PATCH] Renamed filelock for clarity. (new feature passmenu multi-clip)
Kjetil Torgrim Homme
kjetil.homme at redpill-linpro.com
Wed Jul 20 11:46:31 CEST 2016
Den 20. juli 2016 03:09, mitfree skreiv:
>> 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.
also, directory operations are synchronous operations on NFS, so this is
a simple way of supporting locking across NFS clients without a lot of
hairiness.
--
Kjetil T. Homme
Redpill Linpro - Changing the game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20160720/4f45c5ea/attachment.asc>
More information about the Password-Store
mailing list