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

Fly execute does not exclude MacOS extended file attributes #8916

Open
selzoc opened this issue Feb 16, 2024 · 3 comments · May be fixed by #8939
Open

Fly execute does not exclude MacOS extended file attributes #8916

selzoc opened this issue Feb 16, 2024 · 3 comments · May be fixed by #8939
Labels

Comments

@selzoc
Copy link
Contributor

selzoc commented Feb 16, 2024

Summary

fly execute, when run from a recent MacOS machine, does not pass the --no-mac-metadata flag to the tar command. This results in the upload of many files prepended by ._ that represent extended file attributes, which causes issues with builds. For example, if you are running git operations, suddenly you have many untracked files that were not apparent on your local computer.

From the bsdtar man page:

--no-mac-metadata
(x mode only) Mac OS X specific. Do not archive or extract
ACLs and extended file attributes using copyfile(3) in Apple-
Double format. This is the reverse of --mac-metadata. and the
default behavior if tar is run as non-root in x mode.

Steps to reproduce

Clone this repository to $HOME/workspace/concourse, verify that your MacOS machine uses these extended attributes with:

> cd $HOME/workspace/concourse
> xattr -l .github
com.apple.provenance:

Then, using this task.yml:

---
platform: linux

image_resource:
  type: registry-image
  source:
    repository: golang

inputs:
- name: repo

run:
  path: bash
  args:
  - -ec
  - | 
    pushd repo && ls -a | head && popd

run

> fly -t <target> e -c task.yml -i repo=$HOME/workspace/concourse

Expected results

> ./fly -t <target> e -c task.yml -i repo=$HOME/workspace/concourse
uploading repo   done
executing build 545401549 at ...
<clipped irrelvant stuff>
... running bash -ec pushd repo && ls -a | head && popd
/tmp/build/e55deab7/repo /tmp/build/e55deab7
.
..
.agignore
.deepsource.toml
.dockerignore
.env
.github
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
/tmp/build/e55deab7
succeeded

Actual results

(note that every file has a "double" prepended with ._)

> fly -t <target> e -c task.yml -i repo=$HOME/workspace/concourse
uploading repo   done
executing build 545405592 at...
<clipped irrelevant stuff>
...running bash -ec pushd repo && ls -a | head && popd
/tmp/build/e55deab7/repo /tmp/build/e55deab7
.
..
._.agignore
._.deepsource.toml
._.dockerignore
._.env
._.gitignore
._CODE_OF_CONDUCT.md
._CONTRIBUTING.md
._Dockerfile
/tmp/build/e55deab7
succeeded

Additional context

I made a similar fix to the bosh cli, and that change made locally to fly results in the expected output.

However, I saw that the library that fly uses, https://github.com/vmware-archive/go-archive, has been archived for ~2 years (and the last commit was 5 years ago). The library that it was forked from, https://github.com/cloudfoundry/archiver, seems to be maintained, but the interface is different, so it wouldn't be a drop-in replacement.

I am happy to make a PR to https://github.com/vmware-archive/go-archive, but that would necessitate that it be unarchived and eventually bumped in this repo.

What do y'all think would be a good path forward?

Triaging info

  • Concourse version: 7.11.0
  • Browser (if applicable): N/A
  • Did this used to work? Probably not!
@selzoc selzoc added the bug label Feb 16, 2024
@selzoc
Copy link
Contributor Author

selzoc commented Feb 29, 2024

Another thing we could do is just inline the code used from https://github.com/vmware-archive/go-archive and make the fix there. I'd also be happy to PR that, but I'd like to get a go-ahead first.

@taylorsilva
Copy link
Member

@selzoc I'd be happy with a PR bringing in the go-archive code and fixing this issue for mac OS users. If you have time I say go for it! I can help shepherd the PR along.

selzoc added a commit to selzoc/concourse that referenced this issue Apr 5, 2024
This is in preparation for making a modification to it in relation to
concourse#8916.  The original
repo has been archived for several years.
selzoc added a commit to selzoc/concourse that referenced this issue Apr 5, 2024
On recent MacOS machines, tar files created (i.e. from `fly execute`
with a local resource) include files prefixed by `._`.  As a result,
once you transfer this tar file to a Linux system and untar, these files
may interfere with jobs. This flag will prevent that from happening.

Fixes concourse#8916

See cloudfoundry/bosh-utils@f79167b
for a similar fix to the `bosh` cli.
selzoc added a commit to selzoc/concourse that referenced this issue Apr 5, 2024
This is in preparation for making a modification to it in relation to
concourse#8916.  The original
repo has been archived for several years.

Signed-off-by: Chris Selzo <[email protected]>
selzoc added a commit to selzoc/concourse that referenced this issue Apr 5, 2024
On recent MacOS machines, tar files created (i.e. from `fly execute`
with a local resource) include files prefixed by `._`.  As a result,
once you transfer this tar file to a Linux system and untar, these files
may interfere with jobs. This flag will prevent that from happening.

Fixes concourse#8916

See cloudfoundry/bosh-utils@f79167b
for a similar fix to the `bosh` cli.

Signed-off-by: Chris Selzo <[email protected]>
@selzoc selzoc linked a pull request Apr 5, 2024 that will close this issue
@selzoc
Copy link
Contributor Author

selzoc commented Apr 5, 2024

@taylorsilva here you go: #8939.

taylorsilva pushed a commit to selzoc/concourse that referenced this issue Apr 28, 2024
This is in preparation for making a modification to it in relation to
concourse#8916.  The original
repo has been archived for several years.

Signed-off-by: Chris Selzo <[email protected]>
taylorsilva pushed a commit to selzoc/concourse that referenced this issue Apr 28, 2024
On recent MacOS machines, tar files created (i.e. from `fly execute`
with a local resource) include files prefixed by `._`.  As a result,
once you transfer this tar file to a Linux system and untar, these files
may interfere with jobs. This flag will prevent that from happening.

Fixes concourse#8916

See cloudfoundry/bosh-utils@f79167b
for a similar fix to the `bosh` cli.

Signed-off-by: Chris Selzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants