[GH-ISSUE #1766] Windows build backslash issue #861

Closed
opened 2026-03-01 21:46:57 +03:00 by kerem · 4 comments
Owner

Originally created by @benbaker76 on GitHub (Apr 25, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1766

Bug report info

act version:            0.2.44
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        \\.\pipe\docker_engine
Config files:
        C:\Users\headk\.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.18.10
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.44 -X main.commit=220d6f1251aea75c378e5a98546f43cd918e1892 -X main.date=2023-04-01T02:18:17Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         220d6f1251aea75c378e5a98546f43cd918e1892
                vcs.time:             2023-04-01T02:17:52Z
                vcs.modified:         false
Docker Engine:
        Engine version:        20.10.24
        Engine runtime:
        Cgroup version:
        Cgroup driver:
        Storage driver:        windowsfilter
        Registry URI:          https://index.docker.io/v1/
        OS:                    Windows 10 Pro Version 2009 (OS Build 19045.2846)
        OS type:               windows
        OS version:            10.0.19045
        OS arch:               x86_64
        OS kernel:             10.0 19045 (19041.1.amd64fre.vb_release.191206-1406)
        OS CPU:                8
        OS memory:             32748 MB
        Security options:

Command used with act

act push -P windows-2019=-self-hosted

Describe issue

Build fails because the folder used is C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2 when it should be C:/Users/headk/.cache/act/8828939fe4ffb927/act/workflow/2.

It looks like it's removing backslashes from the path.

No response

Workflow content

name: amd64_windows_gcc

on: [push, pull_request]

jobs:

  amd64_windows_gcc:
    runs-on: windows-2019
    timeout-minutes: 5
    defaults:
      run:
        shell: msys2 {0}
    steps:
    - uses: actions/checkout@v3
    - uses: msys2/setup-msys2@v2
      with:
        install: gcc make
    - run: make

Relevant log output

| Database directory: /var/lib/pacman/
| :: Do you want to remove unused repositories? [Y/n]
| removing unused sync repositories...
[amd64_windows_gcc/amd64_windows_gcc]   ❓  ::endgroup::
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main msys2/setup-msys2@v2
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::set-env:: MSYSTEM=MINGW64
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::add-path:: C:\Users\headk\.cache\act\8828939fe4ffb927\tmp\setup-msys2
[amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main gcc -v
| /usr/bin/bash: C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2: No such file or directory
[amd64_windows_gcc/amd64_windows_gcc]   ❌  Failure - Main gcc -v
[amd64_windows_gcc/amd64_windows_gcc] exit status 1
[amd64_windows_gcc/amd64_windows_gcc] 🏁  Job failed
Error: Job 'amd64_windows_gcc' failed

Additional information

No response

Originally created by @benbaker76 on GitHub (Apr 25, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1766 ### Bug report info ```plain text act version: 0.2.44 GOOS: windows GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is unset/empty. Sockets found: \\.\pipe\docker_engine Config files: C:\Users\headk\.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.18.10 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -compiler: gc -ldflags: -s -w -X main.version=0.2.44 -X main.commit=220d6f1251aea75c378e5a98546f43cd918e1892 -X main.date=2023-04-01T02:18:17Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: windows GOAMD64: v1 vcs: git vcs.revision: 220d6f1251aea75c378e5a98546f43cd918e1892 vcs.time: 2023-04-01T02:17:52Z vcs.modified: false Docker Engine: Engine version: 20.10.24 Engine runtime: Cgroup version: Cgroup driver: Storage driver: windowsfilter Registry URI: https://index.docker.io/v1/ OS: Windows 10 Pro Version 2009 (OS Build 19045.2846) OS type: windows OS version: 10.0.19045 OS arch: x86_64 OS kernel: 10.0 19045 (19041.1.amd64fre.vb_release.191206-1406) OS CPU: 8 OS memory: 32748 MB Security options: ``` ### Command used with act ```sh act push -P windows-2019=-self-hosted ``` ### Describe issue Build fails because the folder used is `C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2` when it should be `C:/Users/headk/.cache/act/8828939fe4ffb927/act/workflow/2`. It looks like it's removing backslashes from the path. ### Link to GitHub repository _No response_ ### Workflow content ```yml name: amd64_windows_gcc on: [push, pull_request] jobs: amd64_windows_gcc: runs-on: windows-2019 timeout-minutes: 5 defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v3 - uses: msys2/setup-msys2@v2 with: install: gcc make - run: make ``` ### Relevant log output ```sh | Database directory: /var/lib/pacman/ | :: Do you want to remove unused repositories? [Y/n] | removing unused sync repositories... [amd64_windows_gcc/amd64_windows_gcc] ❓ ::endgroup:: [amd64_windows_gcc/amd64_windows_gcc] ✅ Success - Main msys2/setup-msys2@v2 [amd64_windows_gcc/amd64_windows_gcc] ⚙ ::set-env:: MSYSTEM=MINGW64 [amd64_windows_gcc/amd64_windows_gcc] ⚙ ::add-path:: C:\Users\headk\.cache\act\8828939fe4ffb927\tmp\setup-msys2 [amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main gcc -v | /usr/bin/bash: C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2: No such file or directory [amd64_windows_gcc/amd64_windows_gcc] ❌ Failure - Main gcc -v [amd64_windows_gcc/amd64_windows_gcc] exit status 1 [amd64_windows_gcc/amd64_windows_gcc] 🏁 Job failed Error: Job 'amd64_windows_gcc' failed ``` ### Additional information _No response_
kerem 2026-03-01 21:46:57 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@benbaker76 commented on GitHub (Apr 28, 2023):

I made the following change in host_environment.go and it successfully builds.

func (e *HostEnvironment) GetActPath() string {
	actPath := e.ActPath
	if runtime.GOOS == "windows" {
		actPath = strings.ReplaceAll(actPath, "\\", "/")
	}
	return actPath
}

Output:

[amd64_windows_gcc/amd64_windows_gcc]   ❓  ::endgroup::
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main msys2/setup-msys2@v2
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::set-env:: MSYSTEM=MINGW64
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::add-path:: C:\Users\headk\.cache\act\a572ac3a060595c5\tmp\setup-msys2
[amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main make
| mkdir -p bin
| gcc -O2 -Wall -o bin/gfx2next src/lodepng.c src/zx0.c src/gfx2next.c -lm
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main make
[amd64_windows_gcc/amd64_windows_gcc] 🏁  Job succeeded

Do you want a pull request?

<!-- gh-comment-id:1526835619 --> @benbaker76 commented on GitHub (Apr 28, 2023): I made the following change in `host_environment.go` and it successfully builds. ```go func (e *HostEnvironment) GetActPath() string { actPath := e.ActPath if runtime.GOOS == "windows" { actPath = strings.ReplaceAll(actPath, "\\", "/") } return actPath } ``` Output: ``` [amd64_windows_gcc/amd64_windows_gcc] ❓ ::endgroup:: [amd64_windows_gcc/amd64_windows_gcc] ✅ Success - Main msys2/setup-msys2@v2 [amd64_windows_gcc/amd64_windows_gcc] ⚙ ::set-env:: MSYSTEM=MINGW64 [amd64_windows_gcc/amd64_windows_gcc] ⚙ ::add-path:: C:\Users\headk\.cache\act\a572ac3a060595c5\tmp\setup-msys2 [amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main make | mkdir -p bin | gcc -O2 -Wall -o bin/gfx2next src/lodepng.c src/zx0.c src/gfx2next.c -lm [amd64_windows_gcc/amd64_windows_gcc] ✅ Success - Main make [amd64_windows_gcc/amd64_windows_gcc] 🏁 Job succeeded ``` Do you want a pull request?
Author
Owner

@ChristopherHX commented on GitHub (Apr 28, 2023):

I don't think that running msys2 C:\Users\headk\.cache\act\8828939fe4ffb927\act\workflow\2 is a bug from act.

\ is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert \ to / within the shell and run the script after that. (msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')", I don't claim that this works)

<!-- gh-comment-id:1527790741 --> @ChristopherHX commented on GitHub (Apr 28, 2023): I don't think that running `msys2 C:\Users\headk\.cache\act\8828939fe4ffb927\act\workflow\2` is a bug from act. `\` is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert `\` to `/` within the shell and run the script after that. (`msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')"`, I don't claim that this works)
Author
Owner

@benbaker76 commented on GitHub (Apr 28, 2023):

\ is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert \ to / within the shell and run the script after that. (msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')", I don't claim that this works)

I see backslash replacements in other parts of this tool such as here and here so I don't see why it's not a valid solution to do the same for GetActPath?

<!-- gh-comment-id:1528081881 --> @benbaker76 commented on GitHub (Apr 28, 2023): > `\` is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert `\` to `/` within the shell and run the script after that. (`msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')"`, I don't claim that this works) I see backslash replacements in other parts of this tool such as [here](https://github.com/nektos/act/blob/master/pkg/runner/action.go#L420) and [here](https://github.com/nektos/act/blob/master/pkg/runner/action.go#L429) so I don't see why it's not a valid solution to do the same for `GetActPath`?
Author
Owner

@ChristopherHX commented on GitHub (Apr 28, 2023):

I see backslash replacements in other parts of this tool such

The code you are quoting is for linux container, \ is an escape char on linux.

Seems like the cmd doesn't break while seeing cmd /D /E:ON /V:OFF /S /C "CALL tes443/test.bat", so my concerns are resolved. Create a PR if you want, I'm not the only one who can merge this for you.

<!-- gh-comment-id:1528093719 --> @ChristopherHX commented on GitHub (Apr 28, 2023): > I see backslash replacements in other parts of this tool such The code you are quoting is for linux container, `\` is an escape char on linux. Seems like the cmd doesn't break while seeing `cmd /D /E:ON /V:OFF /S /C "CALL tes443/test.bat"`, so my concerns are resolved. Create a PR if you want, I'm not the only one who can merge this for you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#861
No description provided.