Skip to content

Clean All fails on files that are read only #4331

@alex-code

Description

@alex-code
  • PlatformIO Core.

Configuration

Operating system: Windows 11

PlatformIO Version (platformio --version): 6.0.2

Description of problem

Clean All fails on files that are "Read Only".
Including a git repository in lib_deps some files in the .git directory are marked read only which blocks cleaning.

Steps to Reproduce

  1. Have a project include https://github.com/PaulStoffregen/Encoder.git in lib_deps
  2. Build or let the libs be downloaded
  3. Run Clean All

Actual Results

PermissionError: [WinError 5] Access is denied: 'C:\\Users\\myuser\\Documents\\GitHub\\My-Project\\.pio\\libdeps\\firebeetle32\\Encoder\\.git\\objects\\pack\\pack-87f987569879568m596f8m96f8fjddl0u.idx':

Expected Results

The files to be removed.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:firebeetle32]
monitor_speed = 115200
platform = espressif32
board = firebeetle32
framework = arduino
monitor_filters = esp32_exception_decoder
extra_scripts = extra_script.py
board_build.partitions = no_ota.csv
lib_ldf_mode = chain+
lib_compat_mode = strict
lib_deps = 
	https://github.com/PaulStoffregen/Encoder.git

Additional info

Adding this line os.chmod(dst, stat.S_IWRITE) to the piotarget.py file just before the remove allows the clean to run successfully but I'm not sure if this is the best way to fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions