← Back to issue list

Can't redirect the output of go run to a file

View original Github issue

Metadata

Project
rockcraft
Number
#755
Type
issue
State
open
Author
kian99
Labels
—
Created
Updated
Closed
—

Current evaluation

Reported empty redirected output from go run in override-build; an exact repro exists, but no debug log or maintainer triage was provided and current Rockcraft uses classic confinement.

Suggested action: needs triage

Reason: The report provides a complete rockcraft.yaml, exact commands, and contrasting file sizes, making the behavior reproducible enough to investigate. However, it omits debug output and exit statuses, while the current snap manifest declares classic confinement, so the suspected confinement cause remains unconfirmed and no maintainer assessment or resolving work is recorded.

Evaluated by: mr-cal-bot

Impact: 30 Quick Win: 11 Complexity: 48 Confidence: 78 Actionability: 68

Issue body

### Bug Description When running in the override-build step, the output of `go run` is not being redirected to a file as expected. In my override-build step I am using a go package to do some formatting on a file. As I was typing out this bug report, I realised that I think this is happening because of snap confinement. It feels a bit frustrating to face snap confinement issues while in a build environment. ### To Reproduce Use the rockcraft.yaml below and put an `exit 1` at the start of override-build and run `rockcraft pack --debug`. Then try the following: - go run github.com/openfga/cli/cmd/fga@latest model -h - go run github.com/openfga/cli/cmd/fga@latest model -h > test-file - ls -lah test-file - go install github.com/openfga/cli/cmd/fga@latest - /root/go/bin/fga model -h > test-file - ls -lah test-file On my machine: ``` # go run github.com/openfga/cli/cmd/fga@latest model -h > test-file # ls -lah test-file -rw-r--r-- 1 root root 0 Nov 19 12:31 test-file # /root/go/bin/fga -h > test-file # ls -lah test-file -rw-r--r-- 1 root root 1.5K Nov 19 12:35 test-file ``` As you can see the first attempt results in an empty file (maybe because of snap confinement?) while the second attempt works. ### Environment ``` $ lxc version Client version: 6.1 Server version: 6.1 ``` ### rockcraft.yaml ```yaml name: jimm base: ubuntu@22.04 version: '0.1' summary: Juju Intelligent Model Manager provides a convient way to manage all of your models! description: | JIMM is a Juju controller, used in conjunction with the JaaS dashboard to provide a seamless way to manage models, regardless of where their controllers reside or what cloud they may be running on. license: GPL-3.0 platforms: amd64: parts: ca-certs: plugin: nil overlay-packages: [ca-certificates] builder: plugin: go # https://canonical-craft-parts--694.com.readthedocs.build/en/694/common/craft-parts/reference/plugins/go_plugin.html after: - ca-certs source: . source-type: local build-snaps: - go/1.23/stable build-packages: - git - make build-environment: - GOOS: linux override-build: | set -ex mkdir -p $CRAFT_PART_INSTALL/usr/local/bin make build/server cp ./jimmsrv $CRAFT_PART_INSTALL/usr/local/bin # The location of SQL files isn't configurable right now, as such we just # place it in bin cp -r ./internal/dbmodel/sql $CRAFT_PART_INSTALL/usr/local/bin/sql # Convert the OpenFGA auth model to JSON and place a copy in the ROCK # Used by the charm to apply to the OpenFGA server, not by the container itself mkdir -p $CRAFT_PART_INSTALL/root/openfga/ go install github.com/openfga/cli/cmd/fga@latest go run github.com/openfga/cli/cmd/fga@latest model transform --file ./openfga/authorisation_model.fga --output-format json > $CRAFT_PART_INSTALL/root/openfga/authorisation_model.json exit 1 ``` ### Relevant log output ```shell None ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 30
Quick Win: 11
Complexity: 48
Confidence: 78
Actionability: 68
needs triage Reported empty redirected output from go run in override-build; an exact repro exists, but no debug log or maintainer triage was provided and current Rockcraft uses classic confinement.
stealth/space-bunny-alpha
Impact: 38
Quick Win: 11
Complexity: 58
Confidence: 68
Actionability: 72
needs triage Untriaged report that `go run ... -h > test-file` creates an empty file during override-build, while an installed Go binary writes help; snap confinement is suspected but unconfirmed.
stealth/space-bunny-alpha
Impact: 35
Quick Win: 11
Complexity: 50
Confidence: 50
Actionability: 62
needs triage go run stdout redirection to a file yields an empty file inside override-build; reporter suspects snap confinement. Full repro and rockcraft.yaml supplied. Unlabelled, no maintainer response in 682 days. Likely go build-snap, not rockcraft.
qwen/qwen3.6-35b-a3b
Impact: 35
Quick Win: 12
Complexity: 55
Confidence: 70
Actionability: 75
needs triage go run output cannot be redirected to a file in rockcraft override-build; reporter suspects snap confinement. No maintainer response after 669 days.
qwen/qwen3.8-27b
Impact: 25
Quick Win: 15
Staleness: 85
Complexity: 40
Confidence: 50
Support Request: 25
needs triage go run output redirection produces empty file in rockcraft build environment; user suspects snap confinement. 650 days old, zero comments, no labels, no maintainer response. Go plugin since reworked and stabilized in craft-parts.
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 40
Confidence: 85
Support Request: 35
close stale Report of go run output redirection failing in Rockcraft build environment, producing empty files. Author suspects snap confinement. Untriaged, inactive for 610 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 45
Confidence: 85
Support Request: 30
close stale User reports go run output redirection fails in rockcraft build environment, producing empty files. Suspects snap confinement. Inactive for 595 days with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 50
Confidence: 85
Support Request: 20
close stale User reports `go run` output redirection fails in `rockcraft` override-build, suspecting snap confinement. Issue is 592 days old with no maintainer response.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.