On Jul 28, 2006, at 5:09 AM, Eric Wilhelm wrote:

I just remembered that the kernel argument list limit includes
environment variables.

---
$ perl -e 'warn "going to run system"; $ENV{FOO}="bah"x1000000;
system("perl", "-e", "") and die "oops:  $!\n";'

going to run system at -e line 1.
oops:  Argument list too long
---


Excellent finding! We could at least show some indication of the length of %ENV entries when we encounter this error:

=== lib/Module/Build/Base.pm
==================================================================
--- lib/Module/Build/Base.pm    (revision 1938)
+++ lib/Module/Build/Base.pm    (local)
@@ -3932,7 +3932,13 @@
sub do_system {
   my ($self, @cmd) = @_;
   $self->log_info("@cmd\n");
-  return !system(@cmd);
+  my $status = system(@cmd);
+  if ($status and $! =~ /Argument list too long/i) {
+    my $env_entries = '';
+ foreach (sort keys %ENV) { $env_entries .= "$_=>".length($ENV {$_})."; " }
+    warn "Argument list was too long, env lengths are $env_entries";
+  }
+  return !$status;
}
sub copy_if_modified {


 -Ken

Reply via email to