AIUI creating symlinks in Windows 10+ requires running as administrator unless 
developer mode is enabled. Blog post from Microsoft on the changes: 
https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/ 
<https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/>. I’m 
not sure if there is an easy way to check that setting from Java. UtilTest 
currently ignores all symlink tests on Windows. (It does have one test for 
junctions, which are a little different.)

Since this test is unrelated to posix file permissions so I would just ignore 
it on Windows unconditionally. If you really wanted it to run when symlinks are 
supported then I guess you could run `cmd.exe /C mklink /d link target` using 
ProcessBuilder and if that exits successfully and the symlink exists then 
creating a symlink via NIO should also work.

Devin

> On Apr 16, 2018, at 15:58, Baptiste Mathus <m...@batmat.net> wrote:
> 
> Yeah, introduced in https://github.com/jenkinsci/jenkins/commit/4f2e2615055 
> <https://github.com/jenkinsci/jenkins/commit/4f2e2615055> / 
> https://github.com/jenkinsci/jenkins/pull/2548 
> <https://github.com/jenkinsci/jenkins/pull/2548>
> 
> Just checked, and though the PR history is now deleted, I'm pretty sure the 
> CI did run on Windows for this too. 
> <image.png>
> 
> 
> So there must be a reason why this works or not under some circumstances I 
> suspect.
> 
> I think I will file something tomorrow for this if nobody beats me to it. 
> Though I'd like to understand why it succeeds sometimes or not, maybe just 
> when running under cygwin or not indeed.
> Or maybe I should just try to be smart... Ever.
> And use Functions.isWindows() to disable this globally on Windows, and not 
> just when that new isPosixSupported() method I added returns true or false.
> 
> -- Baptiste
> 
> 
> 2018-04-16 20:55 GMT+02:00 Jesse Glick <jgl...@cloudbees.com 
> <mailto:jgl...@cloudbees.com>>:
> On Sat, Apr 14, 2018 at 1:13 PM, Jonathan Bergh
> <bergh.jonat...@gmail.com <mailto:bergh.jonat...@gmail.com>> wrote:
> > This helper function in the test led me to
> > believe this test should not be running on the Windows platform
> 
> The `checkPermissionsRespectUmask` test is skipped on Windows. (Well,
> at least potentially—not sure about Cygwin.) `symlinkToDirectory` is
> not skipped on Windows. Probably it should start with:
> 
> assumeFalse(Functions.isWindows());
> 
> Feel free to add that and file a PR claiming to follow up
> 
> https://github.com/jenkinsci/jenkins/pull/2548 
> <https://github.com/jenkinsci/jenkins/pull/2548>
> https://github.com/jenkinsci/jenkins/pull/3233 
> <https://github.com/jenkinsci/jenkins/pull/3233>
> https://github.com/jenkinsci/jenkins/pull/3275 
> <https://github.com/jenkinsci/jenkins/pull/3275>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-dev+unsubscr...@googlegroups.com 
> <mailto:jenkinsci-dev%2bunsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2YVN2s7D5QLaKZFzgHXUxBs7j1QZbWaHYzyvQAzju%2BJQ%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2YVN2s7D5QLaKZFzgHXUxBs7j1QZbWaHYzyvQAzju%2BJQ%40mail.gmail.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-dev+unsubscr...@googlegroups.com 
> <mailto:jenkinsci-dev+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS6%3DxQCVqvjJbz95NTcs62mwy90C5jH0fbwCd1cWDL9exQ%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS6%3DxQCVqvjJbz95NTcs62mwy90C5jH0fbwCd1cWDL9exQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/8BCC4947-291B-4FD3-837A-98FAA0395780%40cloudbees.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to