SamWheating opened a new pull request, #29886:
URL: https://github.com/apache/airflow/pull/29886

   While investigating https://github.com/apache/airflow/issues/29112 I found 
another issue in the way that the file task handler checks file access:
   
   
https://github.com/apache/airflow/blob/9745032fa7e05ea7e45266445db44d153c1adb11/airflow/utils/log/file_task_handler.py#L439-L445
   
   The return value of `path.stat().st_mode` will include additional bits 
beyond the 9 access bits (`-RWXRWSRWX`)
   
   As demonstrated here:
   ```python
   >>> from pathlib import Path
   
   >>> p = Path('/opt/airflow/logs/task/mytask')
   
   >>> new_folder_permissions = 0o755
   
   >>> p.mkdir(mode=new_folder_permissions, parents=True, exist_ok=True)
   
   >>> p.stat().st_mode == new_folder_permissions   # Should return true, 
because we just created this directory
   False
   
   >>> format(p.stat().st_mode, 'o')   # Lets look at the full value of 
`std_mode`, oct-formatted
   '42755'
   
   >>> p.stat().st_mode % 0o1000 == new_folder_permissions   # masking out the 
last 9 bits
   True
   ```
   
   While I don't think that this is the only cause of 
https://github.com/apache/airflow/issues/29112, it might lead to unnecessarily 
chmod'ing directories which could then throw errors. 


-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to