Skip to content

file.put with _sudo=True and _chdir is not None can fail if the sudo is required for the chdir to succeed #1426

@morrison12

Description

@morrison12

Describe the bug

Removal of the temporary file fails in the case where the sudo is required for the chdir to succeed/

To Reproduce

Any file.put with:

  1. _chdir is not None`
  2. _sudo=True and
  3. the sudo is required for the `chdir to succeed

Expected behavior

The full operation should succeed.

Meta

System: Darwin
Platform: macOS-14.7.7-arm64-arm-64bit
Release: 23.6.0
Machine: arm64
pyinfra: v3.4.1
click: v8.2.1
click: v8.2.1
click: v8.2.1
distro: v1.9.0
gevent: v25.5.1
jinja2: v3.1.6
packaging: v25.0
paramiko: v3.5.1
python-dateutil: v2.9.0.post0
pywinrm: v0.5.0
typeguard: v4.4.4
typing-extensions: v4.14.1
Executable: /Users/someone/.local/bin/pyinfra
Python: 3.12.11 (CPython, Clang 20.1.4 )

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