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

actions/cache fails when current folder has spaces #2661

Open
manolo opened this issue Feb 11, 2025 · 1 comment
Open

actions/cache fails when current folder has spaces #2661

manolo opened this issue Feb 11, 2025 · 1 comment
Labels
kind/bug Something isn't working

Comments

@manolo
Copy link

manolo commented Feb 11, 2025

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'

Link to GitHub repository

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

@manolo manolo added the kind/bug Something isn't working label Feb 11, 2025
@ChristopherHX
Copy link
Contributor

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants