toradex / vscode-torizon-templates

VS Code Torizon Integrated Development Environment Templates
MIT License
14 stars 20 forks source link

C++/Makefile template runs build steps as root. Autogenerated files are owned on the host by root #186

Closed drewmoseley closed 4 days ago

drewmoseley commented 5 months ago

The C++/Makefile SDK container is running as root. This means that any files generated by the build process will be owned by root in the host system filesystem. Specifically, I am testing rpcgen based applications and after generating the .c and .h files, they are owned by root and I cannot easily manipulate them.

My workaround is to add "USER 1000" just before the WORKDIR statement of Dockerfile.sdk. That works but is hard coded to a user ID of 1000. Ideally we would have a better way to handle this that automatically determined the UID or at least was more easily user configurable.

I assume any other templates that run builds inside containers will have similar issues.

microhobby commented 4 days ago

Thanks for the report @drewmoseley It appears that Torizon containers already define torizon user, so switching to it seems to solve this.