snapcraft 8.2.1: `snapcraft pack` not respecting `<directory>` arg to find `snapcraft.yaml`
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Regression in snapcraft 8.2.1 where snapcraft pack directory argument failed to locate snapcraft.yaml. Fixed and released in version 8.2.6 to latest/stable. Verified by the original reporter and third-party tools. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1541987 snapcraft snap <directory> fails due to looking for package.yaml | snapcraft (launchpad) | closed | Superseded by Snapcraft's migration from package.yaml to snap.yaml. The format change resolved the lookup failure, rendering the report obsolete. |