Skip to content

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

Open

Description

@MichaelThamm

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

Activity

  1. changed the title [-]Set config fails with `OSError: [Errno 9] Bad file descriptor`[/-] [+]Jhack set config fails with redirection (using snap)[/+] on Dec 17, 2024
  2. PietroPasotti commented on Jan 6, 2025

    @PietroPasotti
    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

  3. PietroPasotti commented on Jan 6, 2025

    @PietroPasotti
    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.

  4. PietroPasotti commented on Jan 15, 2025

    @PietroPasotti
    Collaborator

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

  5. MichaelThamm commented on Jan 15, 2025

    @MichaelThamm
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions