Opened 7 years ago

Last modified 3 years ago

#38986 assigned defect

python 2.7 ENOTSUP vs. EOPNOTSUPP discrepancies

Reported by: kabaev@… Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc: kabaev@…, petrrr
Port: python27

Description (last modified by ryandesign (Ryan Schmidt))


Apple's system python errno module contains discrete values for EOPNOTSUPP (102) and ENOTSUP (45), while python build by macports only has EOPNOTSUPP (102) value. When values are discrete, both are required to be defined as globals in the errno module.

The EOPNOTSUPP vs ENOTSUP distinction also breaks copystat routine in shutils module when run on Mac OS X. Shutils contains this code that makes all chflags operation errors to be ignored if underlying OS does not support them:

            if (not hasattr(errno, 'EOPNOTSUPP') or
                why.errno != errno.EOPNOTSUPP):

In reality, when the file system (say, NFS) does not support file flags, it returns the value of 45 in errno, which corresponds to ENOTSUP. The code used to work when ENOTSUP and EOPNOTSUPP were mapped to the same value, but is ineffective now. It cannot be fixed trivially either because errno.ENOTSUP is not present in errno module, as per above. I suggest the patch be committed to python port to 1. make sure errno.ENOTSUP is always defined, and, 2. shutils are adjusted to use errno.ENOTSUPP in the above chflags workaround. I'll see about submitting the patch to upstream, if it is still needed, but would really like so see the workaround in the port meanwhile. Without it one cannot use tools like scons on NFS mounted source trees - scons uses shutils to to the file copying and installation and it trips over chflags errors from NFS right away.

Change History (5)

comment:1 Changed 7 years ago by ryandesign (Ryan Schmidt)

Description: modified (diff)
Keywords: errno shutils removed
Owner: changed from macports-tickets@… to jwa@…

comment:2 Changed 7 years ago by kabaev@…

Cc: kabaev@… added

Cc Me!

comment:3 Changed 7 years ago by jmroot (Joshua Root)

Note that EOPNOTSUPP is not defined in sys/errno.h when __DARWIN_UNIX03 is true.

Last edited 7 years ago by jmroot (Joshua Root) (previous) (diff)

comment:4 Changed 7 years ago by petrrr

Cc: Peter.Danecek@… added

Cc Me!

comment:5 Changed 3 years ago by jmroot (Joshua Root)

Owner: changed from jyrkiwahlstedt to jmroot
Status: newassigned
Note: See TracTickets for help on using tickets.