LeonxLJX opened a new pull request, #2215:
URL: https://github.com/apache/buildstream/pull/2215

   Fixes #38.
   
   ## Problem
   
   BuildStream's CAS backend was not storing or restoring critical file 
metadata including full UNIX file mode (especially setuid/setgid bits) and 
directory mode bits. When artifacts were serialized to CAS and checked out, 
setuid/setgid bits were lost, breaking bootable images and setuid/setgid 
tooling.
   
   ## Solution
   
   Use the Remote Execution API's existing NodeProperties.unix_mode protobuf 
field to preserve full file mode throughout the storage pipeline:
   
   1. Capture full mode when adding files to CAS via 
stat.S_IMODE(os.lstat(path).st_mode)
   2. Serialize mode via node_properties.unix_mode.value for files, 
directories, and symlinks
   3. Deserialize and store mode in _IndexEntry and expose via FileStat.mode
   4. Restore full mode on CAS checkout (falling back to legacy is_executable 
for old artifacts)
   5. Use stored mode in export_to_tar() instead of hardcoded values
   6. Fix FileBasedDirectory chmod on import (previously hardcoded 0o755, 
stripping setuid/setgid)
   
   ## Files Changed
   - src/buildstream/storage/_casbaseddirectory.py
   - src/buildstream/storage/_filebaseddirectory.py
   - src/buildstream/storage/directory.py
   - src/buildstream/_cas/cascache.py
   
   All changes are backwards-compatible with existing artifacts.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to