]> arthur.barton.de Git - bup.git/commitdiff
Choose 2M when SC_ARG_MAX is -1 (unspecified)
authorRob Browning <rlb@defaultvalue.org>
Sun, 29 Nov 2015 18:38:03 +0000 (12:38 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 29 Nov 2015 18:58:09 +0000 (12:58 -0600)
When sysconf() returns -1 for a limit, that means the limit is
"unspecified".  In that case, choose 2M for SC_ARG_MAX instead of the
POSIX minimum, matching (somewhat arbitrarily) the value on a current
16GB Debian amd64 system.

The POSIX minimum was unnecessary, likely inefficient, and causing
unnecessary failures.

Thanks to Mark J Hewitt <m.hewitt@computer.org> for reporting the
problem and tracking down the cause.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py

index 811a8f1f3017f34d2555e083bf00ee123a44743c..e7fbc5b8992a18433d3f54cc5241c8adac5de18c 100644 (file)
@@ -13,8 +13,8 @@ sc_page_size = os.sysconf('SC_PAGE_SIZE')
 assert(sc_page_size > 0)
 
 sc_arg_max = os.sysconf('SC_ARG_MAX')
-if sc_arg_max == -1:
-    sc_arg_max = 4096
+if sc_arg_max == -1:  # "no definite limit" - let's choose 2M
+    sc_arg_max = 2 * 1024 * 1024
 
 # This function should really be in helpers, not in bup.options.  But we
 # want options.py to be standalone so people can include it in other projects.