[GH-ISSUE #2661] actions/cache fails when current folder has spaces #1206

Open
opened 2026-03-01 21:49:40 +03:00 by kerem · 1 comment
Owner

Originally created by @manolo on GitHub (Feb 11, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2661

Bug report info

act version:            0.2.70
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$HOME/.docker/run/docker.sock
Config files:
	/Users/manolo/.actrc:
		#-P ubuntu-latest=catthehacker/ubuntu:full-latest
		-P ubuntu-latest=catthehacker/ubuntu:act-24.04
		#-P ubuntu-latest=catthehacker/ubuntu:runner-24.04
		-P ubuntu-24.04=catthehacker/ubuntu:runner-24.04
		-P ubuntu-20.04=catthehacker/ubuntu:runner-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:runner-18.04
		ubuntu-16.04=catthehacker/ubuntu:runner-16.04
Build info:
	Go version:            go1.23.3
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.70
		DefaultGODEBUG:       asynctimerchan=1,gotypesalias=0,httplaxcontentlength=1,httpmuxgo121=1,httpservecontentkeepheaders=1,tls10server=1,tls3des=1,tlskyber=0,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0,x509keypairleaf=0,x509negativeserial=1
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               amd64
		GOOS:                 darwin
		GOAMD64:              v1
Docker Engine:
	Engine version:        27.4.0
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:
	OS arch:               x86_64
	OS kernel:             6.10.14-linuxkit
	OS CPU:                16
	OS memory:             7837 MB
	Security options:
		name=seccomp,profile=unconfined
		name=cgroupns

Command used with act

act push -W .github/workflows/test.yml

Describe issue

When running actions/cache in a build, it fails if current folder contains a space.

This is the full command sequence you can use for reproducing it:

mkdir -p '/tmp/my home'
cd '/tmp/my home'
mkdir -p .github/workflows
cat - <<EOF > .github/workflows/test.yml
name: Test
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/cache@v4
        with:
          path: '*.txt'
          key: foo-key
      - run: echo foo > foo.txt
EOF
act push -W .github/workflows/test.yml

The error in console is:

[Test/build]   💬  ::debug::Archive Path: /tmp/5f9fa2f4-9113-428e-866b-27aadd5fc7e0/cache.tzst
| [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /tmp/my home --files-from manifest.txt --use-compress-program zstdmt
| /usr/bin/tar: /tmp/my: Cannot open: No such file or directory
| /usr/bin/tar: Error is not recoverable: exiting now
[Test/build]   🚧  ::warning::Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
[Test/build]   ✅  Success - Post actions/cache@v4

The solution should be to enclose the argument to tar with quotes -C '/tmp/my home'

No response

Workflow content

name: Test
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/cache@v4
        with:
          path: '*.txt'
          key: foo-key
      - run: echo foo > foo.txt

Relevant log output

[Test/build]   💬  ::debug::Archive Path: /tmp/9ab78ede-b291-426c-9134-83a98efed61d/cache.tzst
| [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /tmp/my home --files-from manifest.txt --use-compress-program zstdmt
| /usr/bin/tar: /tmp/my: Cannot open: No such file or directory
| /usr/bin/tar: Error is not recoverable: exiting now
[Test/build]   🚧  ::warning::Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
[Test/build]   ✅  Success - Post actions/cache@v4

Additional information

No response

Originally created by @manolo on GitHub (Feb 11, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2661 ### Bug report info ```plain text act version: 0.2.70 GOOS: darwin GOARCH: amd64 NumCPU: 16 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/manolo/.actrc: #-P ubuntu-latest=catthehacker/ubuntu:full-latest -P ubuntu-latest=catthehacker/ubuntu:act-24.04 #-P ubuntu-latest=catthehacker/ubuntu:runner-24.04 -P ubuntu-24.04=catthehacker/ubuntu:runner-24.04 -P ubuntu-20.04=catthehacker/ubuntu:runner-20.04 -P ubuntu-18.04=catthehacker/ubuntu:runner-18.04 ubuntu-16.04=catthehacker/ubuntu:runner-16.04 Build info: Go version: go1.23.3 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.70 DefaultGODEBUG: asynctimerchan=1,gotypesalias=0,httplaxcontentlength=1,httpmuxgo121=1,httpservecontentkeepheaders=1,tls10server=1,tls3des=1,tlskyber=0,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0,x509keypairleaf=0,x509negativeserial=1 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: amd64 GOOS: darwin GOAMD64: v1 Docker Engine: Engine version: 27.4.0 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: x86_64 OS kernel: 6.10.14-linuxkit OS CPU: 16 OS memory: 7837 MB Security options: name=seccomp,profile=unconfined name=cgroupns ``` ### Command used with act ```sh act push -W .github/workflows/test.yml ``` ### Describe issue When running `actions/cache` in a build, it fails if current folder contains a space. This is the full command sequence you can use for reproducing it: ``` mkdir -p '/tmp/my home' cd '/tmp/my home' mkdir -p .github/workflows cat - <<EOF > .github/workflows/test.yml name: Test on: push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/cache@v4 with: path: '*.txt' key: foo-key - run: echo foo > foo.txt EOF act push -W .github/workflows/test.yml ``` The error in console is: ``` [Test/build] 💬 ::debug::Archive Path: /tmp/5f9fa2f4-9113-428e-866b-27aadd5fc7e0/cache.tzst | [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /tmp/my home --files-from manifest.txt --use-compress-program zstdmt | /usr/bin/tar: /tmp/my: Cannot open: No such file or directory | /usr/bin/tar: Error is not recoverable: exiting now [Test/build] 🚧 ::warning::Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 [Test/build] ✅ Success - Post actions/cache@v4 ``` The solution should be to enclose the argument to tar with quotes `-C '/tmp/my home'` ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Test on: push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/cache@v4 with: path: '*.txt' key: foo-key - run: echo foo > foo.txt ``` ### Relevant log output ```sh [Test/build] 💬 ::debug::Archive Path: /tmp/9ab78ede-b291-426c-9134-83a98efed61d/cache.tzst | [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /tmp/my home --files-from manifest.txt --use-compress-program zstdmt | /usr/bin/tar: /tmp/my: Cannot open: No such file or directory | /usr/bin/tar: Error is not recoverable: exiting now [Test/build] 🚧 ::warning::Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 [Test/build] ✅ Success - Post actions/cache@v4 ``` ### Additional information _No response_
Author
Owner

@ChristopherHX commented on GitHub (Feb 11, 2025):

This code calling tar is not from us

please forward to

https://github.com/actions/cache/issues

Act could stop mirroring the spaces of your host OS into the container (docker backend) to avoid common problems / you would work in a folder outside your user profile

<!-- gh-comment-id:2651034184 --> @ChristopherHX commented on GitHub (Feb 11, 2025): This code calling tar is not from us please forward to > https://github.com/actions/cache/issues Act could stop mirroring the spaces of your host OS into the container (docker backend) to avoid common problems / you would work in a folder outside your user profile
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#1206
No description provided.