fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-05 05:08 am

[dw-free] ljlib.pl should autodetect ARCH32

[commit: http://hg.dwscoalition.org/dw-free/rev/d9e05e2ed2ea]

http://bugs.dwscoalition.org/show_bug.cgi?id=3425

Automatically detect whether we are on 32-bit or 64-bit architecture,
instead of setting a manual config flag (thanks mmmpork for pointing this
out!)

Patch by [personal profile] fu and [personal profile] pauamma.

Files modified:
  • cgi-bin/ljdefaults.pl
  • doc/config-private.pl.txt
--------------------------------------------------------------------------------
diff -r bfb304746e81 -r d9e05e2ed2ea cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl	Fri Feb 04 15:59:39 2011 +0800
+++ b/cgi-bin/ljdefaults.pl	Fri Feb 04 14:53:34 2011 +0800
@@ -191,6 +191,17 @@ no strict "vars";
     # Default to allow all reproxying.
     %REPROXY_DISABLE = () unless %REPROXY_DISABLE;
 
+
+    # detect whether we are running on 32-bit architecture
+    my $arch = ( length(pack "L!", 0) == 4 ) ? 1 : 0;
+    if ( defined $ARCH32 ) {
+        die "Can't have ARCH32 set to false on a 32-bit architecture" if $ARCH32 <
+    $arch;
+    } else {
+        $ARCH32 = $arch;
+    }
+
+
     # setup default minimal style information
     $MINIMAL_USERAGENT{$_} ||= 1 foreach qw(Links Lynx w BlackBerry WebTV); # w is for w3m
     $MINIMAL_BML_SCHEME ||= 'lynx';
diff -r bfb304746e81 -r d9e05e2ed2ea doc/config-private.pl.txt
--- a/doc/config-private.pl.txt	Fri Feb 04 15:59:39 2011 +0800
+++ b/doc/config-private.pl.txt	Fri Feb 04 14:53:34 2011 +0800
@@ -51,8 +51,8 @@
             },
         );
 
-    # 32 vs 64 bit arch. By default everything goes to a 64 bit arch.  Uncomment
-    # to enable 32 bit arch support.  
+    # 32 vs 64 bit arch. By default everything goes to a 64 bit arch.
+    # Automatically detected. Uncomment to force 32 bit arch support.
     #
     # WARNING: This must be set prior to setting up your site.  If you change it
     # later on a running site, things may go badly for you.
--------------------------------------------------------------------------------