# HG changeset patch # User Gilles Duboscq # Date 1426504991 -3600 # Node ID bd953f56351746a9acaab8a80adcc8761804b4b6 # Parent e808c83240358e023b8eb82345f75629bc37f4e1 mx: followup fix for SC_ARG_MAX, add more assetions diff -r e808c8324035 -r bd953f563517 mxtool/mx.py --- a/mxtool/mx.py Sun Mar 15 16:22:37 2015 +0100 +++ b/mxtool/mx.py Mon Mar 16 12:23:11 2015 +0100 @@ -2823,13 +2823,16 @@ else: # Using just SC_ARG_MAX without extra downwards adjustment # results in "[Errno 7] Argument list too long" on MacOS. - syslimit = os.sysconf('SC_ARG_MAX') - 20000 + commandLinePrefixAllowance -= 20000 + syslimit = os.sysconf('SC_ARG_MAX') if syslimit == -1: syslimit = 262144 # we could use sys.maxint but we prefer a more robust smaller value limit = syslimit - commandLinePrefixAllowance + assert limit > 0 for i in range(len(files)): path = pathFunction(files[i]) size = len(path) + 1 + assert size < limit if chunkSize + size < limit: chunkSize += size else: