Skip to content
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

Github action throws "ambiguous redirect" on windows #1280

Closed
AlmogBaku opened this issue Sep 24, 2022 · 10 comments
Closed

Github action throws "ambiguous redirect" on windows #1280

AlmogBaku opened this issue Sep 24, 2022 · 10 comments

Comments

@AlmogBaku
Copy link

Description

When running the github action on a windows runner, it throws an error:

Run pipx run --python 'C:\hostedtoolcache\windows\Python\3.10.7\x64\python.exe' --spec 'D:\a\_actions\pypa\cibuildwheel\v2.10.1' cibuildwheel labsdk --output-dir wheelhouse --config-file "" --only "" 2>&1
D:\a\_temp\a5524e03-c41e-47da-af1b-516e94c31164.sh: line 1: 1
: ambiguous redirect

Build log

https://github.com/raptor-ml/raptor/actions/runs/3118890385/jobs/5058490814

CI config

https://github.com/raptor-ml/raptor/blob/228ba6f6b23b9941de01bce29116973d319ed4a2/.github/workflows/labsdk-release.yaml

@joerick
Copy link
Contributor

joerick commented Sep 24, 2022

I'd guess that the problem is that you've installed a different version of bash on your build system.

https://github.com/raptor-ml/raptor/blob/228ba6f6b23b9941de01bce29116973d319ed4a2/.github/workflows/labsdk-release.yaml#L86-L91

Normal runs use bash at C:\Program Files\Git\bin\bash.EXE, yours uses bash at C:\cygwin\bin\bash.EXE. That said, I'm not sure what it's upset about... possibly it's upset with a Windows line-ending.

@joerick
Copy link
Contributor

joerick commented Sep 26, 2022

In your case, you could replace the action with

pip install cibuildwheel==2.10.2
pipx run cibuildwheel labsdk

@AlmogBaku
Copy link
Author

yeah, that's what I did :) But it's still a bug

@joerick
Copy link
Contributor

joerick commented Sep 26, 2022

No idea how we'd fix it, though. If it is indeed a line-ending thing, it seems like an incompatibility between GHA and cygwin bash.

@henryiii
Copy link
Contributor

henryiii commented Sep 26, 2022

You are running GitHub Actions on a flavor of bash it does not support. Actions are pretty tolerant to different environments (I've used them inside various docker images), but it's impossible to support everything if you are customizing the environment around them. You could see if they'd be interested in also supporting that if it's possible, but it's not something we can/should do.

I wonder if we would avoid triggering the bug without the 2>&1? I've tried to avoid that before but have failed (multiple times). Would you like to try making a branch in a fork without that and seeing if it helps? Your stderr/stdout will be all mixed up in ordering, though.

(I think PYTHONUNBUFFERED would help, but haven't succeeded with using it for this - and it might be hard to set it in a cross platform way in the action anyway)

@joerick
Copy link
Contributor

joerick commented Oct 11, 2022

Yeah, I suspect that the cygwin bash lexer is chomping a \r from \r\n and putting it into the redirect. Perhaps even a blob of whitespace after the 2>&1 would work around the bug. Or maybe a semicolon to terminate the statement before the \r\n.

@henryiii
Copy link
Contributor

It doesn't have any newlines, we are using YAML's > here. Have we tried PYTHONUNBUFFERED=1 pipx ... for the action? I thought we had.

@joerick
Copy link
Contributor

joerick commented Oct 11, 2022

Yeah, pretty sure we tried that. Actually I think we apply more-or-less the same thing in code internally, the sys.stdout = Unbuffered(sys.stdout) in __main__.py

@AlmogBaku
Copy link
Author

But why is it even running on cygwin? why not just adjust our action to run on PowerShell on widows, and provide a different command for that?

@joerick
Copy link
Contributor

joerick commented Dec 5, 2022

The github action now uses powershell thanks to #1346

@joerick joerick closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants