python 2.7.12 on Linux behaving differently than on Windows

Chris Angelico rosuav at gmail.com
Tue Dec 6 17:46:26 EST 2016


On Wed, Dec 7, 2016 at 9:35 AM, Nathan Ernst <nathan.ernst at gmail.com> wrote:
> One other consideration in regards to globbing in the argument list: there's
> a static limit to the byte length of argv. On windows, it's 8191 bytes (I'm
> assuming a null-terminator brings that to 8192, which is a weird 2**13). For
> Linux, as of kernal 2.6.25, apparently, the limit is 131072 bytes, an
> equally odd choice of 2**17 bytes.
>
> I'm not sure if globs directly to commands bypass these restrictions, but
> I've seen real world issues with build systems with thousands of files that
> attempted to pass all dependencies to a target that blew up spectacularly
> (one of the reasons cl & link on windows accept argument files as input
> instead of just command line arguments).

A lot of things are a problem in an ecosystem they're not designed
for, but work fine if you have them. If the normal thing is to have
the shell expand globs, the system will expect and assume this,
applications will expect and assume this, and the shell will do this.
If the normal thing is not to, then nobody will expect it. This is
only going to be a problem when you mix ecosystems; for instance, I
don't know what the Win 10 internal bash does, with a limit like that,
and I don't know how Wine apps cope with file names that include
metacharacters in them. But when everything's built consistently, you
don't have a problem.

ChrisA


More information about the Python-list mailing list