Skip to content

[BUG] Dotter doesn't elevate if it can't read a directory #103

Open
@Amir-Ahmad

Description

@Amir-Ahmad

Environment

  • OS: Fedora 35
  • Dotter version: 0.12.13

Description

When specifying a target directory that dotter can't read, dotter fails to create symlinks or templates, even when owner is specified as root.

Reproduction

#Global.toml
[system.files.test]
owner = "root"
target = "/tmp/nonreadable/test"
type = "template"

#local.toml
packages = ["system"]

Create directory user can't read.

sudo mkdir /tmp/nonreadable
sudo chmod 700 /tmp/nonreadable

Expected behavior

I expected dotter to elevate before checking the state of the file/dir as I had specified the "owner" field. Or perhaps elevate if it gets a permission denied.

Actual behavior

Dotter fails with a permission denied.

$ ▶ dotter -v
[ INFO] [+] template "test" -> "/tmp/nonreadable/test"
[ERROR] Failed to create template "test" -> "/tmp/nonreadable/test"
Caused by:
    detect templated file's current state
    get state of target
    read contents of file that isn't symbolic or directory
    Permission denied (os error 13)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions