[GitHub] [airflow] aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] Inherit umask from parent process in daemon mode

2020-03-15 Thread GitBox
aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] 
Inherit umask from parent process in daemon mode
URL: https://github.com/apache/airflow/pull/7724#discussion_r392688027
 
 

 ##
 File path: airflow/cli/commands/celery_command.py
 ##
 @@ -135,6 +135,7 @@ def worker(args):
 
 ctx = daemon.DaemonContext(
 files_preserve=[handle],
+umask=cli_utils.get_umask(),
 
 Review comment:
   I have referred few articles to get into the depth but could find why the 
value should not depend on parent process or what repercussions can it have if 
I inherit it from parent process . However all articles suggest it to set to a 
predefined value. I will make the value configurable with a reasonable default. 
   
   - https://smnd.sk/anino/programming/c/c-faq_comp.unix.programmer/faq_2.html
   - http://www.enderunix.org/docs/eng/daemon.php


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] Inherit umask from parent process in daemon mode

2020-03-14 Thread GitBox
aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] 
Inherit umask from parent process in daemon mode
URL: https://github.com/apache/airflow/pull/7724#discussion_r392611916
 
 

 ##
 File path: airflow/utils/cli.py
 ##
 @@ -238,3 +238,12 @@ def sigquit_handler(sig, frame):  # pylint: 
disable=unused-argument
 if line:
 code.append("  {}".format(line.strip()))
 print("\n".join(code))
+
+
+def get_umask():
+"""
+Returns umask to control default file permission for new files
+"""
+cur_mask = os.umask(0)
+os.umask(cur_mask)
 
 Review comment:
   If I don't set it then the umask for the rest of the execution is set to 0 
and any files created by parent will be created with permissions 0666.  


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] Inherit umask from parent process in daemon mode

2020-03-14 Thread GitBox
aggarwaldeepak commented on a change in pull request #7724: [AIRFLOW-1536] 
Inherit umask from parent process in daemon mode
URL: https://github.com/apache/airflow/pull/7724#discussion_r392611916
 
 

 ##
 File path: airflow/utils/cli.py
 ##
 @@ -238,3 +238,12 @@ def sigquit_handler(sig, frame):  # pylint: 
disable=unused-argument
 if line:
 code.append("  {}".format(line.strip()))
 print("\n".join(code))
+
+
+def get_umask():
+"""
+Returns umask to control default file permission for new files
+"""
+cur_mask = os.umask(0)
+os.umask(cur_mask)
 
 Review comment:
   If I don't set it then the umask of for the rest of the execution is set to 
0 and any files created by parent will be created with permissions 0666.  


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services