This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kevans
Recipients christian.heimes, kevans, koobs, vstinner
Date 2020-06-18.14:06:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1592489210.79.0.890477857923.issue41013@roundup.psfhosted.org>
In-reply-to
Content
I think it's too early to look at this, I'll circle back another time. :-) I got a minute and extracted the relevant test, but I guess there must have been some fundamental transcription error:

import os

fd = os.memfd_create("Hi", os.MFD_CLOEXEC)
if fd == -1:
    print("boo")
    os.exit(1)

if os.get_inheritable(fd):
    print("inheritable, boo")
    os.exit(1)

with open(fd, "wb", closefd=False) as f:
    f.write(b'memfd_create')
    if f.tell() != 12:
        print("Hork")
        os.exit(1)
    print("What?")

print("Done")

When I run this with python3.9, I get:

...
 3038 100554: shm_open2(SHM_ANON,O_RDWR|O_CLOEXEC,00,0,"memfd:Hi") = 3 (0x3)
 3038 100554: fcntl(3,F_GETFD,)          = 1 (0x1)
 3038 100554: fstat(3,{ mode=---------- ,inode=10,size=0,blksize=4096 }) = 0 (0x0)
 3038 100554: ioctl(3,TIOCGETA,0x7fffffffe2a0)   ERR#25 'Inappropriate ioctl for device'
 3038 100554: lseek(3,0x0,SEEK_CUR)      = 0 (0x0)
 3038 100554: lseek(3,0x0,SEEK_CUR)      = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
 3038 100554: write(3,"memfd_create",12)     = 0 (0x0)
(ad infinitum)

So in my local repro, Python is looping forever on successful write() for reasons I'm not immediately sure of.
History
Date User Action Args
2020-06-18 14:06:50kevanssetrecipients: + kevans, vstinner, christian.heimes, koobs
2020-06-18 14:06:50kevanssetmessageid: <1592489210.79.0.890477857923.issue41013@roundup.psfhosted.org>
2020-06-18 14:06:50kevanslinkissue41013 messages
2020-06-18 14:06:50kevanscreate