summaryrefslogtreecommitdiff
path: root/sysutils/parallel/files/patch-src__parallel
blob: c040116a62cadd0712efce28d4b71f75a36c2485 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- ./src/parallel.orig	2013-10-21 15:31:40.000000000 -0500
+++ ./src/parallel	2013-10-23 15:11:54.000000000 -0500
@@ -5538,29 +5538,13 @@
     # Returns:
     #   number of chars on the longest command line allowed
     if(not $Limits::Command::line_max_len) {
-	# Disk cache of max command line length 
-	my $len_cache = $ENV{'HOME'} . "/.parallel/tmp/linelen-" . ::hostname();
-	my $cached_limit;
-	if(-e $len_cache) {
-	    open(my $fh, "<", $len_cache) || ::die_bug("Cannot read $len_cache");
-	    $cached_limit = <$fh>;
-	    close $fh;
-	} else {
-	    $cached_limit = real_max_length();
-	    # If $HOME is write protected: Do not fail
-	    mkdir($ENV{'HOME'} . "/.parallel");
-	    mkdir($ENV{'HOME'} . "/.parallel/tmp");
-	    open(my $fh, ">", $len_cache);
-	    print $fh $cached_limit;
-	    close $fh;
-	}
-	$Limits::Command::line_max_len = $cached_limit;
+        $Limits::Command::line_max_len = `getconf ARG_MAX` - 1024;
 	if($opt::max_chars) {
-	    if($opt::max_chars <= $cached_limit) {
+	    if($opt::max_chars <= $Limits::Command::line_max_len) {
 		$Limits::Command::line_max_len = $opt::max_chars;
 	    } else {
 		::warning("Value for -s option ",
-			  "should be < $cached_limit.\n");
+			  "should be < $Limits::Command::line_max_len.\n");
 	    }
 	}
     }