Skip to content

runtests: use setfacl on Cygwin/MSYS, if present - #16465

Closed
vszakats wants to merge 15 commits into
curl:masterfrom
vszakats:setfacl
Closed

vszakats wants to merge 15 commits into
curl:masterfrom
vszakats:setfacl

Conversation

@vszakats

@vszakats vszakats commented Feb 24, 2025 •

Copy link
Copy Markdown
Member

To use a native Cygwin tool instead of the Windows icacls. It allows
running under Cygwin/MSYS without Windows system folders in the PATH.

Also: fix indentation and tidy up syntax of the icacls branch.

Note: As of this commit, these setfacl and icacls calls are not
necessary for a successful CI run. This includes OpenSSH for Windows
tests, that aren't run by default. Keep them anyway, because locally
they may be necessary depending on environment.

Reported-by: Brian Inglis
Fixes #16437
Ref: #16803


w/o ws https://github.com/curl/curl/pull/16465/files?w=1

@vszakats

vszakats commented Feb 26, 2025 •

Copy link
Copy Markdown
Member Author

This will be impossible or at least unpractical to solve by trial and error.

Copying the message from:
#16437 (comment)

Made an attempt to replicate the icacls effect with setfacl based on
the available documentation and some examples found on GitHub (there
is a total of 35 hits mentioning both tools in the same context.)

https://linux.die.net/man/1/setfacl
https://cygwin.com/cygwin-ug-net/setfacl.html
https://cygwin.com/faq/faq.html#faq.using.ssh-pubkey-stops-working
https://github.com/search?q=icacls+setfacl&type=code

Tried:

curl/tests/sshserver.pl

Lines 421 to 435 in d1440e2

# Make sure that permissions are restricted so openssh doesn't complain
system "chmod 600 " . pp($hstprvkeyf);
system "chmod 600 " . pp($cliprvkeyf);
if($^O eq 'cygwin' || $^O eq 'msys') {
# https://cygwin.com/cygwin-ug-net/setfacl.html
system "setfacl --remove-all " . pp($hstprvkeyf);
system "setfacl --modify u:" . $username . ":r " . pp($hstprvkeyf);
}
elsif($^O eq 'MSWin32') {
# https://ss64.com/nt/icacls.html
$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)) . "\" /grant:r \"$username:(R)\"";
system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /inheritance:r";
}

07014ba

That hit this:

setfacl: illegal acl entries
setfacl: illegal acl entries
setfacl: illegal acl entries
setfacl: illegal acl entries
setfacl: illegal acl entries
setfacl: illegal acl entries
setfacl: illegal acl entries
[...]
Permissions 0650 for '/cygdrive/d/a/curl/curl/bld/tests/log/6/server/curl_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Unable to load host key "/cygdrive/d/a/curl/curl/bld/tests/log/6/server/curl_host_rsa_key": bad permissions
Unable to load host key: /cygdrive/d/a/curl/curl/bld/tests/log/6/server/curl_host_rsa_key

https://github.com/curl/curl/actions/runs/13510332690/job/37749076435?pr=16465#step:12:1181
https://github.com/curl/curl/actions/runs/13510332690/job/37749089183?pr=16465#step:14:1254

What would be the correct call equivalent to icacls?

@vszakats vszakats closed this Feb 26, 2025
@vszakats
vszakats deleted the setfacl branch February 26, 2025 12:43
@vszakats
vszakats restored the setfacl branch February 28, 2025 20:23
@vszakats vszakats reopened this Feb 28, 2025
@vszakats

Copy link
Copy Markdown
Member Author

@vszakats vszakats closed this Feb 28, 2025
@vszakats
vszakats deleted the setfacl branch February 28, 2025 20:53
@vszakats
vszakats restored the setfacl branch March 24, 2025 01:57
@vszakats vszakats reopened this Mar 24, 2025
@vszakats vszakats changed the title runtests: try setfacl with Cygwin/MSYS runtests: replace icacls with setfacl on Cygwin/MSYS Mar 24, 2025
@vszakats
vszakats marked this pull request as ready for review March 24, 2025 02:01
Some Cygwin/MSYS2 (MiniGfW) may not have this tool.
@vszakats vszakats changed the title runtests: replace icacls with setfacl on Cygwin/MSYS runtests: use setfacl on Cygwin/MSYS, if present Mar 24, 2025
@github-actions github-actions Bot added the CI Continuous Integration label Mar 24, 2025
This reverts commit 2a035fb.
This reverts commit 662e532.
This reverts commit 39f003f.
@vszakats vszakats closed this in d838d43 Mar 24, 2025
@vszakats
vszakats deleted the setfacl branch March 24, 2025 09:06
vszakats added a commit that referenced this pull request Mar 24, 2025
Use the `PATH` `/usr/bin` to avoid any Windows system or 3rd-party tool
installed on the runner machine that may interfere with or add undesired
dependencies to the builds and tests.

Follow-up to d838d43 #16465
Ref: #16437

Closes #16814
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
To use a native Cygwin tool instead of the Windows `icacls`. It allows
running under Cygwin/MSYS without Windows system folders in the `PATH`.

Also: fix indentation and tidy up syntax of the `icacls` branch.

Note: As of this commit, these `setfacl` and `icacls` calls are not
necessary for a successful CI run. This includes OpenSSH for Windows
tests, that aren't run by default. Keep them anyway, because locally
they may be necessary depending on environment.

Reported-by: Brian Inglis
Fixes curl#16437
Ref: curl#16803
Closes curl#16465
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Use the `PATH` `/usr/bin` to avoid any Windows system or 3rd-party tool
installed on the runner machine that may interfere with or add undesired
dependencies to the builds and tests.

Follow-up to d838d43 curl#16465
Ref: curl#16437

Closes curl#16814
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration SCP/SFTP script tests

Development

Successfully merging this pull request may close these issues.

curl 8.12.1 cygwin test 582/583 hang infloop ssh-agent using all CPU

1 participant