Skip to content

~ tilde is not suppored in a global config #996

Closed

Description

@thebino

If I want to use ~ in any path in the global config, it will not parse the config and stop with a non-helpful error.

For example if I want to write a logfile to the local .config directory

log-file = "~/.config/rustic/rustic.log"

Same for sources

[[backup.sources]]
source = "~/foo"

On mac the error message is also kind of strange (without showing which config is used)

error: rustic-rs fatal error: I/O operation failed: No such file or directory (os error 2)

Activity

  1. added
    S-triageStatus: Waiting for a maintainer to triage this issue/PR
    on Jan 5, 2024
  2. added
    C-bugCategory: Something isn't working as expected
    A-coreArea: Generally related to `rustic_core`
    A-ui-uxArea: Related to user interfaces and user experience
    A-configArea: Related to the config file functionality and format
    and removed
    S-triageStatus: Waiting for a maintainer to triage this issue/PR
    on Jan 6, 2024
  3. added
    C-enhancementCategory: New feature or request
    and removed
    C-bugCategory: Something isn't working as expected
    on Jan 11, 2024
  4. aawsome commented on Jan 11, 2024

    @aawsome
    Member

    As ~ is IMO just a special case of variable substitution (here the env variable $HOME), I'm closing this as duplicate of #942

  5. simonsan commented on Feb 9, 2024

    @simonsan
    Contributor

    Discovered this library lately: https://docs.rs/crate/shellexpand/3.1.0

    Maybe worth another discussion, if we can implement it with that more easily?

    Reopening for that discussion

  6. simonsan commented on Feb 9, 2024

    @simonsan
    Contributor

    Copying over the discussion points of env var expansion:

    This feature is a bit more involved as there are more questions arising:

    • Do we only want variable substitution in filenames or elsewhere in the config?
    • Do we want to allow substition only within strings?
    • Do we want to first parse the TOML, then substitute what is appropriate or first substitute and then parse (which would allow to define TOML structures within env variables)?

    Originally posted by @aawsome in #942 (comment)

  7. added
    A-filesystemArea: Related to the Filesystem in one way or the other
    on Mar 15, 2024
  8. Dialga commented on Sep 13, 2025

    @Dialga

    ditto, as a first time user, i am also affected by this.
    my config has repo = '~/repo' but instead ./~/repo is used.

  9. rdelaage commented on Oct 10, 2025

    @rdelaage
    Contributor

    I didn't see this issue before, but I think it should be closed as #1577 brings environment variable substitution in config file. Users can use something like "$HOME/.config/rustic/rustic.log", or even "${XDG_CONFIG_HOME:$HOME/.config}/rustic/rustic.log"

  10. aawsome commented on Oct 10, 2025

    @aawsome
    Member

    I agree with @rdelaage. With #1577, environment variable substitutions have been added allowing to use $HOME or ${HOME} in the config profiles. I don't see the need to substitute also ~.

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

    A-configArea: Related to the config file functionality and formatA-coreArea: Generally related to `rustic_core`A-filesystemArea: Related to the Filesystem in one way or the otherA-ui-uxArea: Related to user interfaces and user experienceC-enhancementCategory: New feature or requestC-wontfixCategory: This will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions