[Python-Dev] Strange umask(?)/st_mode issue

Ivan Pozdeev vano at mail.mipt.ru
Sat Mar 30 14:26:30 EDT 2019


On 30.03.2019 19:00, Steve Dower wrote:
> On 29Mar.2019 1944, Steve Dower wrote:
>> On 29Mar.2019 1939, Cameron Simpson wrote:
>>> Can you get a branch into your pipeline? Then you could just hack the
>>> tarfile test with something quick and dirty like:
>>>
>>>     pid = os.getpid()
>>>     system("strace -p %d 2>/path/to/strace.out &" % pid)
>>>     time.sleep(2)   # get strace heaps of time to start
>>>
>>> just before the tarfile open. A ghastly hack but it would get you
>>> debugging info. You could even decide to remove the strace.out file if
>>> the umask issue doesn't show, if it is erratic (can't see why it would
>>> be though).
>> Perfect, I'll give this a go. Thanks!
> I set up a PR to collect this trace and the results are at:
> https://github.com/python/cpython/pull/12625
>
> However, I suspect it's a non-result:
>
> umask(022)                              = 022
> open("/home/vsts/work/1/s/build/test_python_5154/@test_5154_tmp-tardir/tmp.tar",
> O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 3
> write(3, "BZh91AY&SYY{\270\344\0\0\24P\0\300\0\4\0\0\10
> \0000\314\5)\246"..., 46) = 46
> close(3)                                = 0
> stat("/home/vsts/work/1/s/build/test_python_5154/@test_5154_tmp-tardir/tmp.tar",
> {st_mode=S_IFREG|0666, st_size=46, ...}) = 0
>
> Happy to take more suggestions if anyone has them.

According to https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent 
, MS uses Ubuntu 16.04

http://manpages.ubuntu.com/manpages/xenial/man2/umask.2.html suggests that umask is ignored if the parent directory has a default ACL (a 
newly-created dir inherits those from its parent).

As per https://linuxconfig.org/how-to-manage-acls-on-linux , the following commands should show if acls are enabled on the current FS and if 
any are active on the dir:

DEVICE=$(df <location> | tail -n +2 | awk '{print $1}')
sudo tune2fs -l $DEVICE | grep -w "Default mount options"
mount | grep -w $DEVICE
getfacl <location>

In `getfacl' output for a directory, entries that start with "default:" list the default ACL .

`setfacl -b <location>' removes all ACLs from location.

> Thanks,
> Steve
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru

-- 
Regards,
Ivan



More information about the Python-Dev mailing list