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

Packing project content fails if there are UNIX domain sockets #176

Open
thp-canonical opened this issue Feb 5, 2024 · 2 comments
Open

Comments

@thp-canonical
Copy link

thp-canonical commented Feb 5, 2024

If there's any stray UNIX domain sockets in the project directory, Spread fails to pack the project.

To reproduce this issue, create a socket (you can Ctrl+C the command as soon as it's started, we just want the side effect of creating a socket):

nc -lkU foo.sock

With this in place, trying to run spread fails (example project has a LXD backend, but this issue is most likely independent of backend):

spread -vv lxd

The error message:

2024-02-05 15:15:39 Error packing project content for delivery: cannot pack project tree: tar: foo.sock: socket ignored

As a workaround, we currently run find . -type s -delete before running spread to remove any UNIX domain sockets.

GNU tar supports configurable warning messages using --warning= with:

              file‐ignored
                     "%s: Unknown file type; file ignored"
                     "%s: socket ignored"
                     "%s: door ignored"

The file-ignored warning ignores:

  • Unknown file types (see calls to unknown_file_error() in src/create.c in tar's source)
  • UNIX domain sockets
  • Doors, a Solaris-specific concept

It seems like one could add --warning=no-file-ignored to work around this issue:

diff --git a/spread/runner.go b/spread/runner.go
index c84ff63..ebf4b00 100644
--- a/spread/runner.go
+++ b/spread/runner.go
@@ -277,7 +277,7 @@ func (r *Runner) prepareContent() (err error) {
                return fmt.Errorf("cannot remove temporary content file: %v", err)
        }
 
-       args := []string{"c", "--exclude=.spread-reuse.*"}
+       args := []string{"c", "--exclude=.spread-reuse.*", "--warning=no-file-ignored"}
        if r.project.Repack == "" {
                args[0] = "cz"
        }

In my local tests, this fixed the issue and lets spread pack the local tree, ignoring any UNIX domain sockets.

@ZeyadYasser
Copy link
Collaborator

ZeyadYasser commented Mar 20, 2024

@thp-canonical you could use the exclude config in spread.yaml to exclude any unwanted files (if their pattern is knowm), please check https://github.com/snapcore/spread/blob/master/README.md#including.

@thp-canonical
Copy link
Author

@thp-canonical you could use the exclude config in spread.yaml to exclude any unwanted files (if their pattern is know), please check https://github.com/snapcore/spread/blob/master/README.md#including.

cc @paul-rodriguez would that work for you?

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