runtests: try setfacl with Cygwin/MSYS

This commit is contained in:
Viktor Szakats 2025-02-25 00:50:10 +01:00
parent 3c87021d51
commit c9009e04c7
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View File

@ -421,7 +421,11 @@ if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) ||
# Make sure that permissions are restricted so openssh doesn't complain # Make sure that permissions are restricted so openssh doesn't complain
system "chmod 600 " . pp($hstprvkeyf); system "chmod 600 " . pp($hstprvkeyf);
system "chmod 600 " . pp($cliprvkeyf); system "chmod 600 " . pp($cliprvkeyf);
if(pathhelp::os_is_win()) { if($^O eq 'cygwin' || $^O eq 'msys') {
system "setfacl --remove-all " . pp($hstprvkeyf);
system "setfacl --modify u:" . $username . ":r " . pp($hstprvkeyf);
}
elsif($^O eq 'MSWin32') {
# https://ss64.com/nt/icacls.html # https://ss64.com/nt/icacls.html
$ENV{'MSYS2_ARG_CONV_EXCL'} = '/reset'; $ENV{'MSYS2_ARG_CONV_EXCL'} = '/reset';
system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /reset"; system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /reset";