← Back to issue list

snapcraft 8.2.1: `snapcraft pack` not respecting `<directory>` arg to find `snapcraft.yaml`

View original Github issue

Metadata

Project
snapcraft
Number
#4769
Type
issue
State
closed
Author
dbungert
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in Snapcraft 8.2.6 by PR #4794 (commit 48483c4e3), restoring project-file lookup for snapcraft pack <directory>; the reporter confirmed the fix.

Resolution: closed resolved

Reason: PR #4794 was merged as commit 48483c4e3 and released in Snapcraft 8.2.6. The reporter retested 8.2.6 successfully, and downstream users also reported passing tests.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description When using snapcraft 8.2.1, I find that repacking an existing snap by using the directory arg has regressed. Reverting snapcraft (to 8.0.5 in my case) allows this to work again. ### To Reproduce ``` snap download hello unsquashfs hello_42.snap snapcraft pack squashfs-root --output hello.snap ``` workaround: ``` snap download hello unsquashfs hello_42.snap cd squashfs-root snapcraft pack . --output ../hello.snap ``` ### Environment Ubuntu 24.04 ### snapcraft.yaml ```shell # n/a ``` ### Relevant log output ```shell 2024-04-29 15:05:47.128 Starting snapcraft, version 8.2.1 2024-04-29 15:05:47.128 Log verbosity level set to BRIEF 2024-04-29 15:05:47.128 Configuring application... 2024-04-29 15:05:47.128 Preparing application... 2024-04-29 15:05:47.129 Build plan: platform=None, build_for=None 2024-04-29 15:05:47.129 Project file 'snapcraft.yaml' not found in '/tmp/tmp.2ItMSEP6Oi'. 2024-04-29 15:05:47.129 Detailed information: The project file could not be found. 2024-04-29 15:05:47.131 Traceback (most recent call last): 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/snapcraft/application.py", line 136, in _resolve_project_path 2024-04-29 15:05:47.131 return super()._resolve_project_path(project_dir / "snap") 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/craft_application/application.py", line 242, in _resolve_project_path 2024-04-29 15:05:47.131 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-04-29 15:05:47.131 s = self._accessor.realpath(self, strict=strict) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-04-29 15:05:47.131 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-04-29 15:05:47.131 st = os.lstat(newpath) 2024-04-29 15:05:47.131 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.2ItMSEP6Oi/snap' 2024-04-29 15:05:47.131 2024-04-29 15:05:47.131 During handling of the above exception, another exception occurred: 2024-04-29 15:05:47.131 Traceback (most recent call last): 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/snapcraft/application.py", line 139, in _resolve_project_path 2024-04-29 15:05:47.131 return super()._resolve_project_path(project_dir) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/craft_application/application.py", line 242, in _resolve_project_path 2024-04-29 15:05:47.131 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-04-29 15:05:47.131 s = self._accessor.realpath(self, strict=strict) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-04-29 15:05:47.131 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-04-29 15:05:47.131 st = os.lstat(newpath) 2024-04-29 15:05:47.131 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.2ItMSEP6Oi/snapcraft.yaml' 2024-04-29 15:05:47.131 2024-04-29 15:05:47.131 During handling of the above exception, another exception occurred: 2024-04-29 15:05:47.131 Traceback (most recent call last): 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/craft_application/application.py", line 263, in get_project 2024-04-29 15:05:47.131 project_path = self._resolve_project_path(self.project_dir) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/snapcraft/application.py", line 141, in _resolve_project_path 2024-04-29 15:05:47.131 return super()._resolve_project_path(project_dir / "build-aux" / "snap") 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/lib/python3.10/site-packages/craft_application/application.py", line 242, in _resolve_project_path 2024-04-29 15:05:47.131 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-04-29 15:05:47.131 s = self._accessor.realpath(self, strict=strict) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-04-29 15:05:47.131 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-04-29 15:05:47.131 File "/snap/snapcraft/11471/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-04-29 15:05:47.131 st = os.lstat(newpath) 2024-04-29 15:05:47.131 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.2ItMSEP6Oi/build-aux' 2024-04-29 15:05:47.131 Recommended resolution: Ensure the project file exists. ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in Snapcraft 8.2.6 by PR #4794 (commit 48483c4e3), restoring project-file lookup for snapcraft pack <directory>; the reporter confirmed the fix.
stealth/space-bunny-alpha — closed resolved Fixed in snapcraft 8.2.6 by merged PR #4794 (commit 48483c4e3), restoring directory-based snapcraft pack behavior; the reporter confirmed the fix.
stealth/space-bunny-alpha — closed resolved Regression in 8.2.1 (pack ignored the <directory> arg) was fixed by PR #4794 (commit 48483c4e3), released in Snapcraft 8.2.6; reporter and goreleaser/chezmoi users confirmed the fix.
stealth/space-bunny-alpha — closed resolved Fixed in Snapcraft 8.2.6 by PR #4794 (48483c4e3), which restored use of the directory argument when packing. The reporter and downstream users confirmed the fix.
qwen/qwen3.6-35b-a3b — — snapcraft 8.2.1 regressed the pack command, failing to locate snapcraft.yaml in the specified directory. Resolved in 8.2.6 and released to latest/stable. Confirmed fixed by the reporter and third-party tools.
qwen/qwen3.6-35b-a3b — — Fixed snapcraft 8.2.1 regression where snapcraft pack directory failed to locate snapcraft.yaml. Resolved unintentional breaking change and released in 8.2.6 to latest/stable. Multiple users verified the fix.
qwen/qwen3.6-35b-a3b — — Fixed a regression in snapcraft 8.2.1 where the directory argument to snapcraft pack failed to locate snapcraft.yaml. The unintentional regression was resolved in snapcraft 8.2.6 and verified by multiple users.
qwen3.6-35b-a3b-mtp-q6 — — Fixed regression in snapcraft 8.2.1 where snapcraft pack ignored the directory argument for locating snapcraft.yaml. Resolved in version 8.2.6 and released to latest/stable. Multiple users confirmed the fix.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#4794 (confidence 100%)

    Merged fix for allowing snapcraft pack to operate on a supplied directory.

  • Related To: goreleaser#4816 (confidence 98%)

    Downstream report of the same regression; its tests passed with Snapcraft 8.2.6.

Related issues

Issue Project State Summary Similarity
#4794 feat: allow packing a directory snapcraft merged Merged PR #4794 (commit 48483c4e3) restores `snapcraft pack <directory>`, fixing the 8.2 regression where the directory argument was ignored when locating snapcraft.yaml; closes issue #4769 (CRAFT-2861).
80%
#1541987 snapcraft snap <directory> fails due to looking for package.yaml snapcraft (launchpad) closed Bug fixed in merged PR ubuntu-core/snapcraft#297 (commit 53236ee): `snapcraft snap <directory>` now looks for snap.yaml instead of the obsolete package.yaml.
77%
#5083 ".snapcraft.yaml" not picked up as a project file snapcraft closed Fixed in Snapcraft 8.9 for core24 by PR #5349, which rebased Snapcraft onto craft-application 5 and restored .snapcraft.yaml detection.
73%
#1983571 snapcraft pack --use-lxd ask for the optional directory snapcraft (launchpad) closed Fixed in Snapcraft 8+ by commit 48483c4e3 / PR #4794; pack now accepts --use-lxd with an optional directory.
71%