maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #00126
Re: [patch 02/11] Fix permissions race in mysql-test-run.pl on global port allocation semaphore file.
Hi!
>>>>> "knielsen" == knielsen <knielsen@xxxxxxxxxxxxxxx> writes:
knielsen> The globally writable lock file for the mysql-test-run.pl port
knielsen> allocation was not always made globally writable, causing failures for
knielsen> subsequent runs by other users on the same machine.
knielsen> === modified file 'mysql-test/lib/mtr_unique.pm'
knielsen> ---
knielsen> mysql-test/lib/mtr_unique.pm | 6 ++++--
knielsen> 1 file changed, 4 insertions(+), 2 deletions(-)
knielsen> Index: mysql-test/lib/mtr_unique.pm
knielsen> ===================================================================
knielsen> --- mysql-test/lib/mtr_unique.pm.orig 2009-04-07 13:40:36.000000000 +0200
knielsen> +++ mysql-test/lib/mtr_unique.pm 2009-04-07 13:42:05.000000000 +0200
knielsen> @@ -62,13 +62,14 @@ sub mtr_get_unique_id($$) {
knielsen> die 'lock file is a symbolic link';
knielsen> }
knielsen> - chmod 0777, "$file.sem";
knielsen> open SEM, ">", "$file.sem" or die "can't write to $file.sem";
knielsen> + chmod 0777, "$file.sem";
knielsen> flock SEM, LOCK_EX or die "can't lock $file.sem";
knielsen> if(! -e $file) {
knielsen> open FILE, ">", $file or die "can't create $file";
knielsen> close FILE;
knielsen> }
knielsen> + chmod 0777, $file;
Would it be easier/safer to temporally set the umask for the process,
instead of doing a chmod?
That way, we don't get a problem if the
process dies between open and chmod.
That's also a way to avoid the problem that files in the 'var'
directory from the previous run can't be deleted by next user.
<cut>
ok to push, but think about the above idea.
Regards,
Monty
References