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

Jhack set config fails with redirection (using snap) #202

Open
MichaelThamm opened this issue Dec 17, 2024 · 4 comments · Fixed by #203
Open

Jhack set config fails with redirection (using snap) #202

MichaelThamm opened this issue Dec 17, 2024 · 4 comments · Fixed by #203

Comments

@MichaelThamm
Copy link

MichaelThamm commented Dec 17, 2024

Bug Description

Unable to write to config.toml on fresh snap install of Jhack

To Reproduce

sudo snap install jhack
jhack conf destructive > ~/.config/jhack/config.toml

Environment

Version:
jhack 0.4.4.0.2 --DEVMODE--

Relevant log output

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
OSError: [Errno 9] Bad file descriptor

Additional context

jhack conf destructive | tee ~/.config/jhack/config.toml works

@MichaelThamm MichaelThamm changed the title Set config fails with OSError: [Errno 9] Bad file descriptor Jhack set config fails with redirection (using snap) Dec 17, 2024
@PietroPasotti
Copy link
Collaborator

@MichaelThamm I'm not sure what's going on. On my machine I get a different error, a 'no such file or directory' because the .config/jhack folder does not exist.

Do you by any chance see a warning like

WARNING:jhack./snap/jhack/x1/lib/python3.12/site-packages/jhack/conf/conf.py:failed to create default user config in ~/.config/jhack/config.toml. You'll have to do that manually.                                                           

in the output of jhack conf destructive?
That means jhack is failing to create the file ~/.config/jhack/config.toml, for some reason.

To confirm, could you run snappy-debug on the side? you should see something like:
Log: apparmor="DENIED" operation="mkdir" class="file" profile="snap.jhack.jhack" name="~/.config/jhack/" pid=590756 comm="python3" requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000

@PietroPasotti
Copy link
Collaborator

ehm it seems that snapcraft.yaml only has read premissions for that path, while we've been granted write. in theory that should fix the issue I am having.

@PietroPasotti
Copy link
Collaborator

this should be fixed on edge, could you confirm @MichaelThamm

@MichaelThamm
Copy link
Author

I installed version 0.4.4.0.11, tried jhack conf destructive > ~/.config/jhack/config.toml, and still get:

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
OSError: [Errno 9] Bad file descriptor

I have the same issue with juju export-bundle > tee bundle.yaml and resort to using tee as well so this makes me think this could be my shell. Not sure ...

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

Successfully merging a pull request may close this issue.

2 participants