-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Js_run_binary copy srcs to bin fails on 'hidden' files on Windows #1055
Comments
Thanks for the bug report and analysis. Presumably, changing the bazel-lib to xcopy here would fix this? https://github.com/aspect-build/bazel-lib/blob/d13884f29d4f6cfc1ae4dd9d9ac9334ac0de9214/lib/private/copy_file.bzl#L45 |
cc @jbedard |
@ahmedneilhussain would you be able to test the fix from bazel-contrib/bazel-lib#427? |
Sure - I have just rebuilt my windows environment for a different part of the stuff I was working on when I ran into this, so it might take a short while until I can try it - if I don't follow up tomorrow please nag me. Since I'm already invoking rules_js off a commit rather than a release I guess I can just point the WORKSPACE url at your GitHub fork & branch and it should just work? Was there no need to use the |
Correct, I think just replacing the |
Hi, I've tried it and I'm afraid it doesn't work. It hangs waiting for input. See https://stackoverflow.com/questions/4283312/why-does-the-command-xcopy-in-batch-file-ask-for-file-or-folder for the grim details. I think your best bet is to use the target directory rather than the target file as a second argument. I also think you need the |
@ahmedneilhussain do you think you'd be able to checkout the branch in bazel-contrib/bazel-lib#427 and try your suggestion? Otherwise looks like I'll have to find a windows machine... |
Hi, I played around with it but unfortunately I tried replacing I suppose one could try (x)copying the file to a temporary name and renaming it when in place, but that's obviously extra logic. I also haven't checked to see whether DOS rename plays nicely with hidden files. Windows cmd line utilities are horrible 1970s relics so trying to do anything industrial strength and reliable with them is an uphill struggle. Microsoft isn't really bothering with them since powershell came along but that isn't guaranteed to be available. We use python binaries to wrap the various much more robust python file handling utilities in our bazel builds, but I suppose that's a huge dependency to impose on your consumers... |
I don't think we'll spend much more time on this, windows isn't our priority unless we get funding for it. @ahmedneilhussain feel free to open a PR if you have any other ideas or solutions |
What happened?
Porting some
rules_nodejs
builds torules_js
, have a source file starting with a dot (.eleventy.js
) featuring as input to thesrcs
attribute of ajs_run_binary
rule withcopy_srcs_to_bin = True
.Falls over with The system cannot find the file specified.
I see the rule generates cmd files wrapping calls to dos
copy
, which apparently does not copy hidden files (need to use xcopy for that, it seems).Luckily the file name was not significant for us and renaming it to e.g.
coco.eleventy.js
fixed the issue.Version
Development (host) and target OS/architectures:
Windows 10 Pro 21H2
Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz 2.30 GHz (2 processors)
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:https://github.com/aspect-build/rules_js/archive/002397780d51735f1a98b362fca7018df31e85ac.tar.gz
(Need the commit because fix for newer pnpm-lock.yaml syntax not yet in a release)
Language(s) and/or frameworks involved:
bazel 7.0.0-pre.20230316.2
How to reproduce
Any other information?
No response
The text was updated successfully, but these errors were encountered: