[MacPorts] #64806: multiprocess.shared_memory.SharedMemory name too long

MacPorts noreply at macports.org
Fri Mar 11 21:09:18 UTC 2022


#64806: multiprocess.shared_memory.SharedMemory name too long
--------------------+--------------------
 Reporter:  gma-uw  |      Owner:  (none)
     Type:  defect  |     Status:  new
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:
--------------------+--------------------
 From the python documentation example at
 https://docs.python.org/3/library/multiprocessing.shared_memory.html

 {{{
 from multiprocessing import shared_memory
 shm_a = shared_memory.SharedMemory(create=True, size=10, name='a'*31)
 type(shm_a.buf)
 buffer = shm_a.buf
 print (len(buffer))
 buffer[:4] = bytearray([22, 33, 44, 55])  # Modify multiple at once
 buffer[4] = 100                           # Modify single byte at a time
 # Attach to an existing shared memory block
 shm_b = shared_memory.SharedMemory(shm_a.name)
 import array
 array.array('b', shm_b.buf[:5])  # Copy the data into a new array.array
 shm_b.buf[:5] = b'howdy'  # Modify via shm_b using bytes
 bytes(shm_a.buf[:5])      # Access via shm_a
 shm_b.close()   # Close each SharedMemory instance
 shm_a.close()
 shm_a.unlink()  # Call unlink only once to release the shared memory
 }}}

 If name is longer that 30 characters, I get the error:
 OSError: [Errno 63] File name too long: '/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

 The documentation
 https://docs.python.org/3/library/multiprocessing.shared_memory.html says
 nothing about the length of name.

 This is on an M1 Mac.

-- 
Ticket URL: <https://trac.macports.org/ticket/64806>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list