espressif / vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
Apache License 2.0
1.03k stars 300 forks source link

devcontainer creates files as wrong user (VSC-1495) #1320

Open tobiashagge opened 20 hours ago

tobiashagge commented 20 hours ago

OS

Windows

Operating System version

Windows 11 (but within the provided docker image for blink)

Visual Studio Code version

1.93.1

ESP-IDF version

1.8.1

Python version

3.12.3

Doctor command output

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report --------------------------------------------- OS linux x64 5.15.153.1-microsoft-standard-WSL2 System environment variable IDF_PYTHON_ENV_PATH /opt/esp/python_env/idf5.4_py3.12_env System environment variable PATH /vscode/vscode-server/bin/linux-x64/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/bin/remote-cli:/opt/esp/idf/components/espcoredump:/opt/esp/idf/components/partition_table:/opt/esp/idf/components/app_update:/opt/esp/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin:/opt/esp/tools/riscv32-esp-elf-gdb/14.2_20240403/riscv32-esp-elf-gdb/bin:/opt/esp/tools/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-14.2.0_20240906/riscv32-esp-elf/bin:/opt/esp/tools/esp32ulp-elf/2.38_20240113/esp32ulp-elf/bin:/opt/esp/tools/cmake/3.30.2/bin:/opt/esp/tools/openocd-esp32/v0.12.0-esp32-20240821/openocd-esp32/bin:/opt/esp/tools/qemu-xtensa/esp_develop_9.0.0_20240606/qemu/bin:/opt/esp/tools/qemu-riscv32/esp_develop_9.0.0_20240606/qemu/bin:/opt/esp/python_env/idf5.4_py3.12_env/bin:/opt/esp/idf/tools:/opt/qemu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin System environment variable PYTHON undefined Visual Studio Code version 1.93.1 Visual Studio Code language en Visual Studio Code shell /usr/bin/bash ESP-IDF Extension version 1.8.1 Workspace folder /workspaces/blink ---------------------------------------------------- Extension configuration settings ------------------------------------------------------ ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH} ESP-IDF Path (idf.espIdfPath) /opt/esp/idf ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH} ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH} ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) ${env:HOMEKIT_PATH} Custom extra paths (idf.customExtraPaths) Custom extra vars (idf.customExtraVars) OPENOCD_SCRIPTS: d:\Espressif\tools\openocd-esp32\v0.12.0-esp32-20240318/openocd-esp32/share/openocd/scripts IDF_CCACHE_ENABLE: 1 ESP_ROM_ELF_DIR: d:\Espressif\tools\esp-rom-elfs\20240305/ Virtual env Python Path (idf.pythonBinPath) /opt/esp/python_env/idf5.4_py3.12_env/bin/python Serial port (idf.port) /dev/ttyUSB1 OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,board/esp32-wrover.cfg ESP-IDF Tools Path (idf.toolsPath) /opt/esp Git Path (idf.gitPath) /usr/bin/git Notification Mode (idf.notificationMode) All -------------------------------------------------------- Configurations access ------------------------------------------------------------- Access to ESP-ADF Path (idf.espAdfPath) false Access to ESP-IDF Path (idf.espIdfPath) true Access to ESP-MDF Path (idf.espMdfPath) false Access to ESP-Matter Path (idf.espMatterPath) false Access to ESP-HomeKit Path (idf.espHomeKitSdkPath) false Access to ESP-IDF Custom extra paths Access to Virtual env Python Path (idf.pythonBinPath) true Access to CMake in environment PATH true Access to Ninja in environment PATH true Access to ESP-IDF Tools Path (idf.toolsPath) true -------------------------------------------------------- Configurations has spaces ------------------------------------------------------------- Spaces in system environment Path false Spaces in ESP-ADF Path (idf.espAdfPath) false Spaces in ESP-IDF Path (idf.espIdfPath) false Spaces in ESP-MDF Path (idf.espMdfPath) false Spaces in ESP-Matter Path (idf.espMatterPath) false Spaces in ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) false Spaces in ESP-IDF Custom extra paths Spaces in Virtual env Python Path (idf.pythonBinPath) false Spaces in ESP-IDF Tools Path (idf.toolsPath) false ----------------------------------------------------------- Executables Versions ----------------------------------------------------------- Git version 2.43.0 ESP-IDF version 5.4.0 Python version 3.12.3 Python's pip version 24.2 -------------------------------------------------- Project configuration settings ---------------------------------------------------------- -------------------------------------------------- Python packages in idf.pythonBinPath ---------------------------------------------------- annotated-types version: 0.7.0 argcomplete version: 3.5.0 bitarray version: 2.9.2 bitstring version: 4.2.3 certifi version: 2024.8.30 cffi version: 1.17.1 charset-normalizer version: 3.3.2 click version: 8.1.7 colorama version: 0.4.6 construct version: 2.10.70 cryptography version: 43.0.1 ecdsa version: 0.19.0 esp-coredump version: 1.11.0 esp-idf-kconfig version: 2.3.0 esp-idf-monitor version: 1.5.0 esp_idf_nvs_partition_gen version: 0.1.3 esp-idf-panic-decoder version: 1.2.1 esp-idf-size version: 1.6.0 esptool version: 4.8.0 freertos-gdb version: 1.0.3 idf-component-manager version: 2.0.3 idna version: 3.10 intelhex version: 2.3.0 jsonref version: 1.1.0 markdown-it-py version: 3.0.0 mdurl version: 0.1.2 packaging version: 24.1 pip version: 24.2 psutil version: 6.0.0 pyclang version: 0.5.0 pycparser version: 2.22 pydantic version: 2.9.2 pydantic_core version: 2.23.4 pydantic-settings version: 2.5.2 pyelftools version: 0.31 pygdbmi version: 0.11.0.0 Pygments version: 2.18.0 pyparsing version: 3.1.4 pyserial version: 3.5 python-dotenv version: 1.0.1 PyYAML version: 6.0.2 reedsolo version: 1.7.0 requests version: 2.32.3 requests-file version: 2.1.0 requests-toolbelt version: 1.0.0 rich version: 13.8.1 setuptools version: 71.0.0 six version: 1.16.0 tqdm version: 4.66.5 typing_extensions version: 4.12.2 urllib3 version: 2.2.3 ---------------------------------------------------- Check ESP-IDF python requirements.txt ------------------------------------------------- Check ESP-IDF Python packages Python requirements are satisfied. ---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------ Check Debug AdapterPython packages Error ---------------------------------------------------- Visual Studio Code launch.json -------------------------------------------------------- { "version": "0.2.0", "configurations": [ { "type": "gdbtarget", "request": "attach", "name": "Eclipse CDT GDB Adapter" }, { "type": "espidf", "name": "Launch", "request": "launch" } ] } ---------------------------------------------------- Visual Studio Code c_cpp_properties.json ---------------------------------------------- { "configurations": [ { "name": "ESP-IDF", "compilerPath": "${config:idf.toolsPathWin}\tools\xtensa-esp-elf\esp-13.2.0_20240530\xtensa-esp-elf\bin\xtensa-esp32-elf-gcc.exe", "compileCommands": "${config:idf.buildPath}/compile_commands.json", "includePath": [ "${config:idf.espIdfPath}/components/", "${config:idf.espIdfPathWin}/components/", "${workspaceFolder}/**" ], "browse": { "path": [ "${config:idf.espIdfPath}/components", "${config:idf.espIdfPathWin}/components", "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": true } } ], "version": 4 }

----------------------------------------------------------- Latest error ----------------------------------------------------------------- { "code": 1, "killed": false, "signal": null, "cmd": "/opt/esp/python_env/idf5.4_py3.12_env/bin/python /opt/esp/idf/tools/check_python_dependencies.py -r /.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/esp_debug_adapter/requirements.txt" }

----------------------------------------------------------- Logfile ----------------------------------------------------------------- {"message":"Open On-Chip Debugger v0.12.0-esp32-20240821 (2024-08-21-14:42)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n","stack":"Error: Open On-Chip Debugger v0.12.0-esp32-20240821 (2024-08-21-14:42)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\n\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1424988\n\tat ChildProcess.exithandler (node:child_process:414:7)\n\tat ChildProcess.emit (node:events:519:28)\n\tat maybeClose (node:internal/child_process:1105:16)\n\tat Socket. (node:internal/child_process:457:11)\n\tat Socket.emit (node:events:519:28)\n\tat Pipe. (node:net:338:12)","level":"error","timestamp":"2024-09-28T02:59:17.165Z"} {"message":"Cannot access filePath: ${env:ADF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ADF_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1650824\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T03:16:31.614Z"} {"message":"Cannot access filePath: ${env:MDF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:MDF_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651002\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T03:16:31.615Z"} {"message":"Cannot access filePath: ${env:ESP_MATTER_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ESP_MATTER_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651094\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T03:16:31.615Z"} {"message":"Cannot access filePath: ${env:HOMEKIT_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:HOMEKIT_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651190\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T03:16:31.615Z"} {"message":"Cannot access filePath: ${env:ADF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ADF_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1650824\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T04:08:53.914Z"} {"message":"Cannot access filePath: ${env:MDF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:MDF_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651002\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T04:08:53.914Z"} {"message":"Cannot access filePath: ${env:ESP_MATTER_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ESP_MATTER_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651094\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T04:08:53.915Z"} {"message":"Cannot access filePath: ${env:HOMEKIT_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:HOMEKIT_PATH}'\n\tat Object.accessSync (node:fs:244:11)\n\tat Se (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1421806)\n\tat /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651190\n\tat ua (/home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1651892)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n\tat async /home/esp/.vscode-server/extensions/espressif.esp-idf-extension-1.8.1/dist/extension.js:2:1868405","level":"error","timestamp":"2024-09-28T04:08:53.915Z"}


Extension

Lots of messages, but none are obviously (to me) relevant. Example:

{"message":"Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:26)\r\nLicensed under GNU GPL v2\r\nFor bug reports, read\r\n\thttp://openocd.org/doc/doxygen/bugs.html\r\n","stack":"Error: Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:26)\r\nLicensed under GNU GPL v2\r\nFor bug reports, read\r\n\thttp://openocd.org/doc/doxygen/bugs.html\r\n\n\tat c:\Users\Tobe\.vscode\extensions\espressif.esp-idf-extension-1.8.1\dist\extension.js:2:1424988\n\tat ChildProcess.exithandler (node:child_process:415:7)\n\tat ChildProcess.emit (node:events:519:28)\n\tat maybeClose (node:internal/child_process:1105:16)\n\tat ChildProcess._handle.onexit (node:internal/child_process:305:5)","level":"error","timestamp":"2024-09-28T02:59:09.670Z"}

Description

1) Install vs-code, c++ build tools, esp-idf extension, WSL, dev-containers, blink getting started example source code. 2) Open blink in the provided container. 3) > idf.py --set-target esp32 4) A wall of text appears, with a number of 'permission denied' errors. Se below for the first several lines of output. 5) Some troubleshooting later... (I can provide details) 6) When the 'esp' user writes files, the ownership appears to change to 'ubuntu'. The permission errors appear to be file copy operations for which the 'esp' user has read permissions to access the source, and prior to the start of the script, the target file does not exist. After the script fails, the files mentioned do exist, but have user and group set to 'ubuntu'. 7) When creating a file, the os appears to check for 'esp' permissions, but create the file as user 'ubuntu'. esp@681d5ae3abf2:/workspaces/blink$ whoami esp esp@681d5ae3abf2:/workspaces/blink$ ls test ls: cannot access 'test': No such file or directory esp@681d5ae3abf2:/workspaces/blink$ touch test esp@681d5ae3abf2:/workspaces/blink$ ls -l test -rwxrwxrwx 1 ubuntu ubuntu 0 Sep 28 04:22 test

Any ideas or advice are appreciated.

Debug Message

esp@681d5ae3abf2:/workspaces/blink$ idf.py set-target esp32
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/workspaces/blink/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32, new sdkconfig will be created.
Running cmake in directory /workspaces/blink/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/opt/esp/python_env/idf5.4_py3.12_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=1 /workspaces/blink"...
-- Found Git: /usr/bin/git (found version "2.43.0")
CMake Error at /opt/esp/idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:78 (configure_file):
  Operation not permitted
Call Stack (most recent call first):
  /opt/esp/idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:93 (get_git_head_revision)
  /opt/esp/idf/tools/cmake/build.cmake:99 (git_describe)
  /opt/esp/idf/tools/cmake/build.cmake:272 (__build_get_idf_git_revision)
  /opt/esp/idf/tools/cmake/idf.cmake:53 (__build_init)
  /opt/esp/idf/tools/cmake/project.cmake:29 (include)
  CMakeLists.txt:5 (include)

-- ccache will be used for faster recompilation
CMake Error at /opt/esp/tools/cmake/3.30.2/share/cmake-3.30/Modules/CMakeDetermineSystem.cmake:218 (configure_file):
  Operation not permitted
Call Stack (most recent call first):
  /opt/esp/idf/tools/cmake/project.cmake:564 (__project)
  CMakeLists.txt:6 (project)

Other Steps to Reproduce

I have reproduced the error on four different machines, all running Windows 11, two with fresh installs of VS code, VS code C++ tools, WSL, and extensions.

I have checked existing issues, online documentation and the Troubleshooting Guide

tobiashagge commented 3 hours ago

This seems like the sort of thing that would be user error in the configuration steps but I'm at a bit of a loss. I don't see the behavior if I create another project and add another dev container (python3) to it. I do see the behavior if I install the hello_world example project.