github-actions[bot] commented on code in PR #40693:
URL: https://github.com/apache/beam/pull/40693#discussion_r4328257398


##########
website/build.gradle:
##########
@@ -177,7 +177,7 @@ task downloadPerformanceLooks(type: Exec) {
 
       mkdir -p "\$OUT_DIR"
       # mkdir above runs as root. The leaf directory must be writable by the 
host uid.
-      chown "\$HOST_UID:\$HOST_GID" "\$OUT_DIR"
+      chown "\$HOST_UID:\$HOST_GID" "\$(dirname "\$OUT_DIR")"

Review Comment:
   **🔴 Critical**: `mkdir -p "\$OUT_DIR"` runs as `root` and creates both 
`.../images/performance` and `.../images/performance/looks` (`OUT_DIR`). 
Running `chown` without `-R` on `"\$(dirname "\$OUT_DIR")"` only changes the 
ownership of the parent `performance` directory, leaving the leaf directory 
`OUT_DIR` (`looks`) owned by `root:root` (`0755`).
   
   As a result, the subsequent `gosu "\$HOST_UID:\$HOST_GID" gcloud storage 
rsync -r "\$SRC" "\$OUT_DIR"` command will fail with a permission error when 
attempting to write files into `OUT_DIR` (and the workflow only passes because 
the `if ... else` block swallows the error as a warning, publishing the website 
without performance plots).
   
   Use `-R` so both `performance` and `performance/looks` are owned by 
`HOST_UID:HOST_GID` (or run `mkdir -p` under `gosu "\$HOST_UID:\$HOST_GID"`).
   
   ```suggestion
         chown -R "\$HOST_UID:\$HOST_GID" "\$(dirname "\$OUT_DIR")"
   ```



-- 
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