python 2.7.12 on Linux behaving differently than on Windows

BartC bc at freeuk.com
Tue Dec 6 20:55:38 EST 2016


On 06/12/2016 22:35, Nathan Ernst 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

That's the length of the command line, where parameters might still be 
in the form *.*, ie. pre-splitting and pre-expansion. After converting 
to argv format (which I believe is done by a C runtime function), that 
will be in different memory with presumably its own limits.

> (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.

Maybe they started off at 4KB and 64KB but ran into problems.

But even Linux's 128KB will fill if someone wanted a command line that 
listed 20,000 files individually. But it would be spectacularly bad use 
of a command line interface which was designed for humans.

> 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).

So does gcc on Linux (if you mean the @file syntax). It's a tidier way 
of doing things.

-- 
Bartc


More information about the Python-list mailing list