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

Syntax error: "(" unexpected with manylinux_2_28-cross:aarch64 container #46

Open
wangxiaoying opened this issue Feb 29, 2024 · 1 comment

Comments

@wangxiaoying
Copy link

Got syntax error during setup-poetry runs on ubuntu-latest with container: ghcr.io/rust-cross/manylinux_2_28-cross:aarch64.

Here is the action link: https://github.com/sfu-db/connector-x/actions/runs/8091126113/job/22109709826#step:7:7
Here is the workflow definition: https://github.com/sfu-db/connector-x/blob/prerelease/.github/workflows/release.yml#L95

Will be appreciated if anyone can give me some pointer on this. Thanks!

@tanmay-sahasrabudhe
Copy link

Hi, not sure who I need to tag here, but we have also been blocked as we want to use connector-x on an arm64 instance. So I took a look at the issue that @wangxiaoying mentioned above and I have a little more information about this issue. The logs on the connector-x actions have been wiped now, but I was able to recreate the same issue by forking it locally. The error log for the setup-poetry@v9 action for aarch64 architecture is:

/usr/bin/docker exec  da2f1873eb7b603718dd30b439ceba7521e7d32194e617fb9ed89598c2ed97c9 sh -c "cat /etc/*release | grep ^ID"
/opt/python/cp311-cp311/bin/python /__w/_temp/aaba40c0-aa91-40bd-b443-ddbd4d1e6878 --yes
/opt/python/cp311-cp311/bin/python: 1: Syntax error: word unexpected (expecting ")")
Error: The process '/opt/python/cp311-cp311/bin/python' failed with exit code 2

Doing some googling on this issue, I was able to find this link that specifies it's an issue with the file extensions for the python file the action is trying to run - https://stackoverflow.com/questions/33075561/unable-to-run-py-file-from-putty-syntax-error-word-unexpected-expecting
It's not the exact same issue, but the error log this person got is very similar to what I got. As such, I did further digging into the setup-poetry code and was able to find where the above command seems to be run in the src/find.ts file:

export async function findPoetry(inputs: Inputs): Promise<void> {
  // Download get-poetry.py
  const getPoetryPath = await downloadTool(GET_POETRY_URL)

  // Run Poetry installation script
  await exec("python", [getPoetryPath, ...getPoetryInstallArgs(inputs)])

Here, the downloadTool function call returns the path of the python file that will be run. This function is returning the path in the form of

/__w/_temp/aaba40c0-aa91-40bd-b443-ddbd4d1e6878

Digging further into this downloadTool function in @actions/tool-cache, I was able to find the source code for the function in the file - https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L38
The problem path comes from the first line of the function
dest = dest || path.join(_getTempDirectory(), uuidV4())
This function is creating a file path with no extension, which seems to be what's causing the action to then fail for aarch64 architecture builds. The downloadTool function does take an optional argument of dest, so what I think the fix would be is to simply pass the path explicitly in the setup-poetry code. Something like this:

export async function findPoetry(inputs: Inputs): Promise<void> {
  // Get download path
  const path = `/temp/${uuidv4()}.py`

  // Download get-poetry.py
  const getPoetryPath = await downloadTool(GET_POETRY_URL, path)

  // Run Poetry installation script
  await exec("python", [getPoetryPath, ...getPoetryInstallArgs(inputs)])

I don't really have the time to set it up locally and test it out, but I am hoping it helps debugging the issue further for someone who can take this up. LMK if this was helpful.

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

2 participants