[Pkg-mono-svn-commits] rev 2759 - in mono/trunk/debian: . patches

Mirco Bauer meebey-guest at costa.debian.org
Tue Oct 3 13:41:49 UTC 2006


Author: meebey-guest
Date: 2006-10-03 13:41:48 +0000 (Tue, 03 Oct 2006)
New Revision: 2759

Added:
   mono/trunk/debian/dh_monoaot
   mono/trunk/debian/patches/fix_tmp_race_r65441.dpatch
   mono/trunk/debian/postinst-monoaot
   mono/trunk/debian/prerm-monoaot
Modified:
   mono/trunk/debian/changelog
   mono/trunk/debian/control
   mono/trunk/debian/dh_clideps
   mono/trunk/debian/dh_makeclilibs
   mono/trunk/debian/patches/00list
   mono/trunk/debian/rules
Log:
- 1.1.17.1-5 release



Modified: mono/trunk/debian/changelog
===================================================================
--- mono/trunk/debian/changelog	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/changelog	2006-10-03 13:41:48 UTC (rev 2759)
@@ -1,3 +1,17 @@
+mono (1.1.17.1-5) unstable; urgency=high
+
+  * Mirco 'meebey' Bauer:
+    + debian/patches/fix_tmp_race_r65441.dpatch:
+      - Fixes tempfile race condition (CVE-2006-5072), taken from upstream SVN.
+    + debian/control:
+      - Added mono binary packages to Build-Conflicts, else it tries to use it
+        during bootstrap and fails.
+    + debian/dh_clideps
+      debian/dh_makeclilibs:
+      - Synced from cli-common-dev 0.4.6.
+
+ -- Debian Mono Group <pkg-mono-group at lists.alioth.debian.org>  Tue, 3 Oct 2006 14:02:21 +0200
+
 mono (1.1.17.1-4) unstable; urgency=high
 
   * Mirco 'meebey' Bauer:

Modified: mono/trunk/debian/control
===================================================================
--- mono/trunk/debian/control	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/control	2006-10-03 13:41:48 UTC (rev 2759)
@@ -3,6 +3,7 @@
 Priority: optional
 Maintainer: Debian Mono Group <pkg-mono-group at lists.alioth.debian.org>
 Uploaders: Eduard Bloch <blade at debian.org>, Mirco Bauer <meebey at meebey.net>, Sebastian Dröge <slomo at ubuntu.com>
+Build-Conflicts: mono-jit, mono-common, mono-jay, libmono0, libmono-corlib1.0-cil, libmono-corlib2.0-cil
 Build-Depends: debhelper (>= 5.0.0), libglib2.0-dev (>= 2.4), bison, libtool, dpatch, libxml-dom-perl, libxslt1-dev, dc, libx11-dev, libxt-dev, libgc-dev [kfreebsd-i386], zlib1g-dev
 Standards-Version: 3.7.2
 

Modified: mono/trunk/debian/dh_clideps
===================================================================
--- mono/trunk/debian/dh_clideps	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/dh_clideps	2006-10-03 13:41:48 UTC (rev 2759)
@@ -57,7 +57,7 @@
 
 =item B<-l>directory[:directory:directory:..]
 
-Before mondis is run, MONO_GAC_PREFIX have added to it the specified directory (or
+Before mondis is run, MONO_GAC_PREFIX and MONO_PATH are set to the specified directory (or
 directories -- separate with colons). This is useful for multi-binary packages where a library is
 built in one package and another package contains binaries linked against said library. Relative
 paths will be made absolute for the benefit of monodis.
@@ -74,9 +74,15 @@
 Suppose that your source package produces libfoo1.0-cil and libbar1.0-cil
 binary packages.
 In your rules file, first run dh_makeclilibs, then dh_clideps:
-
+  (MONO_GAC_PREFIX example)
   dh_makeclilibs -V
   dh_clideps -l debian/libfoo1.0-cil/usr:debian/libbar1.0-cil/usr
+or
+  (MONO_PATH example)
+  dh_clideps -l debian/foo-application/usr/lib/foo-application
+or
+  (MONO_GAC_PREFIX example)
+  dh_clideps -l debian/tmp/usr
 
 =cut
 
@@ -90,32 +96,47 @@
 my $pwd = `pwd`;
 chomp $pwd;
 
-my $mono_gac_prefix = "/usr";
+my $mono_gac_prefix = "";
+my $mono_path = "";
 if ($dh{L_PARAMS}) { 
-  my @paths=();
+  my @mono_paths = ();
+  my @mono_gac_prefixes = ();
   # Add to existing paths, if set.
-  push @paths, $ENV{'MONO_GAC_PREFIX'} if exists $ENV{'MONO_GAC_PREFIX'};
+  push(@mono_gac_prefixes, $ENV{'MONO_GAC_PREFIX'}) if exists $ENV{'MONO_GAC_PREFIX'};
+  push(@mono_paths,        $ENV{'MONO_PATH'}) if exists $ENV{'MONO_PATH'};
   foreach (split(/:/, $dh{L_PARAMS})) {
     # Force the path absolute.
+    my $full_path;
     if (m:^/:) {
-      push @paths, $_;
+      $full_path = $_;
     } else {
-      push @paths, getcwd()."/$_";
+      $full_path = getcwd()."/$_";
     }
+    if (-d "$full_path/lib/mono/gac") {
+      # it's a GAC prefix
+      push(@mono_gac_prefixes, $full_path);
+    } else {
+      # it's a Mono PATH
+      push(@mono_paths, $full_path);
+    }
   }
-  $mono_gac_prefix .= ":" . join(':', @paths);
+  $mono_gac_prefix .= ":" . join(':', @mono_gac_prefixes);
+  $mono_path       .= ":" . join(':', @mono_paths);
+} else {
+  $mono_gac_prefix = $ENV{'MONO_GAC_PREFIX'} if exists $ENV{'MONO_GAC_PREFIX'};
+  $mono_path       = $ENV{'MONO_PATH'} if exists $ENV{'MONO_PATH'};
 }
 
 if (defined($ARGV[0]) && $ARGV[0] eq "internal-mono") {
     $clr = "mono";
     $cli_parser = "$pwd/debian/tmp/usr/bin/monodis";
-    $cli_parser_paths = "LD_LIBRARY_PATH=$pwd/debian/tmp/usr/lib MONO_PATH=$pwd/debian/tmp/usr/lib/mono/1.0:$pwd/debian/tmp/usr/lib/mono/2.0 MONO_GAC_PREFIX=$mono_gac_prefix ";
+    $cli_parser_paths = "LD_LIBRARY_PATH=$pwd/debian/tmp/usr/lib MONO_PATH=$mono_path:$pwd/debian/tmp/usr/lib/mono/1.0:$pwd/debian/tmp/usr/lib/mono/2.0 MONO_GAC_PREFIX=$mono_gac_prefix ";
     $cli_version = `LD_LIBRARY_PATH=$pwd/debian/tmp/usr/lib $pwd/debian/tmp/usr/bin/mono --version 2>&1`;
     verbose_print("Will use built Mono (debian/tmp/usr/bin/monodis) for CIL parsing.");
 } elsif (-x "/usr/bin/monodis") {
     $clr = "mono";
     $cli_parser = "/usr/bin/monodis";
-    $cli_parser_paths = "MONO_GAC_PREFIX=$mono_gac_prefix ";
+    $cli_parser_paths = "MONO_PATH=$mono_path MONO_GAC_PREFIX=$mono_gac_prefix ";
     verbose_print("Will use Mono (/usr/bin/monodis) for CIL parsing.");
 } elsif (-x "/usr/bin/ildasm") {
     $clr = "pnet";
@@ -130,8 +151,8 @@
   open(FILE, 'debian/control');
   my @filedata = <FILE>;
   close(FILE);
-  if (!($filedata[0] =~ /Build-Depends(-Indep)?: .*cli-common-dev \(>= 0\.4\.0\)/)) {
-      warning("Warning! No Build-Depends(-Indep) on cli-common-dev (>= 0.4.0)!");
+  if (!($filedata[0] =~ /Build-Depends(-Indep)?: .*cli-common-dev \(>= 0\.4\.4\)/)) {
+      warning("Warning! No Build-Depends(-Indep) on cli-common-dev (>= 0.4.4)!");
   }
 }
 
@@ -205,7 +226,7 @@
 
     # find binaries
     find (sub {
-        return unless -f and /\.(exe|dll)$/;
+        return unless -f && !-l && /\.(exe|dll)$/;
         my $vers;
         my $file = $_;
         if (/\.exe$/) {
@@ -442,6 +463,7 @@
      my $target = $dllmapdata{$name};
      
      if (defined($target)) {
+       $target = basename($target);
        verbose_print("Resolved moduleref via DLL map: $name to: $target");
      } elsif (defined($shlibdata{$name})) {
        verbose_print("Resolved moduleref via direct match in shlibs");

Modified: mono/trunk/debian/dh_makeclilibs
===================================================================
--- mono/trunk/debian/dh_makeclilibs	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/dh_makeclilibs	2006-10-03 13:41:48 UTC (rev 2759)
@@ -147,8 +147,8 @@
   open(FILE, 'debian/control');
   my @filedata = <FILE>;
   close FILE;
-  if (!($filedata[0] =~ /Build-Depends(-Indep)?: .*cli-common-dev \(>= 0\.4\.0\)/)) {
-      warning("Warning! No Build-Depends(-Indep) on cli-common-dev (>= 0.4.0)!");
+  if (!($filedata[0] =~ /Build-Depends(-Indep)?: .*cli-common-dev \(>= 0\.4\.4\)/)) {
+      warning("Warning! No Build-Depends(-Indep) on cli-common-dev (>= 0.4.4)!");
   }
 }
 

Added: mono/trunk/debian/dh_monoaot
===================================================================
--- mono/trunk/debian/dh_monoaot	                        (rev 0)
+++ mono/trunk/debian/dh_monoaot	2006-10-03 13:41:48 UTC (rev 2759)
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_monoaot - generates AOT images for assemblies
+
+=cut
+
+use strict;
+use File::Find;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_monoaot> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+dh_monoaot is a debhelper program that is responsible for
+generating AOT images at package install time.
+
+It also automatically generates the postinst and prerm commands needed
+to generate AOT images. See L<dh_installdeb(1)> for an
+explanation of how this works.
+
+This is based on L<dh_installcligac(1)> in the cli-common package.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/prerm scripts.
+
+=back
+
+=head1 NOTES
+
+Note that this command is not idempotent. "dh_clean -k" should be called
+between invocations of this command. Otherwise, it may cause multiple
+instances of the same text to be added to maintainer scripts.
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+  my $tmp = tmpdir($package);
+  my @files;
+  
+  # find binaries
+  find (sub {
+    return unless -f and /\.(exe|dll)$/;
+    return unless $File::Find::dir =~ m!^$tmp/usr/lib!;
+    
+    my $fullfilename = $File::Find::name;
+    
+    my $filename = $fullfilename;
+    $filename =~ s/^$tmp//;
+    
+    verbose_print("fullfilename: $fullfilename");
+    verbose_print("filename: $filename");
+    push(@files, $filename);
+  }, $tmp);
+  
+  if (! $dh{NOSCRIPTS}) {
+    foreach my $file (@files) {
+      autoscript($package, "postinst", "postinst-monoaot",
+                 "s!#FILE#!$file!");
+      autoscript($package, "prerm", "prerm-monoaot",
+                 "s!#FILE#!$file.so!");
+    }
+  }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of cli-common-dev.
+
+=head1 AUTHOR
+
+Mirco 'meebey' Bauer <meebey at meebey.net>
+
+=cut


Property changes on: mono/trunk/debian/dh_monoaot
___________________________________________________________________
Name: svn:executable
   + *

Modified: mono/trunk/debian/patches/00list
===================================================================
--- mono/trunk/debian/patches/00list	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/patches/00list	2006-10-03 13:41:48 UTC (rev 2759)
@@ -1,4 +1,4 @@
 remove_broken_dllmap_from_mono-shlib-cop.dpatch
 console-no-utf8-bom.dpatch
 arm_support_larger_stack_r65218.dpatch
-
+fix_tmp_race_r65441.dpatch

Added: mono/trunk/debian/patches/fix_tmp_race_r65441.dpatch
===================================================================
--- mono/trunk/debian/patches/fix_tmp_race_r65441.dpatch	                        (rev 0)
+++ mono/trunk/debian/patches/fix_tmp_race_r65441.dpatch	2006-10-03 13:41:48 UTC (rev 2759)
@@ -0,0 +1,118 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_tmp_race_r65441.dpatch by Mirco Bauer <meebey at meebey.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad mono-1.1.17.1~/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs mono-1.1.17.1/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
+--- mono-1.1.17.1~/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs	2006-10-03 15:17:50.000000000 +0200
++++ mono-1.1.17.1/mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs	2006-10-03 15:18:17.000000000 +0200
+@@ -31,6 +31,7 @@
+ using System.IO;
+ using System.Security;
+ using System.Security.Permissions;
++using System.Runtime.InteropServices;
+ 
+ namespace System.CodeDom.Compiler {
+ 
+@@ -45,6 +46,7 @@
+ 		bool keepfiles;
+ 		string basepath;
+ 		Random rnd;
++		string ownTempDir;
+ 		
+ 		public TempFileCollection ()
+ 			: this (String.Empty, false)
+@@ -67,16 +69,15 @@
+ 		{
+ 			get {
+ 				if(basepath==null) {
+-					// note: this property *cannot* change TempDir property
+-					string temp = tempdir;
+-					if (temp.Length == 0) {
+-						// this call ensure the Environment permissions check
+-						temp = Path.GetTempPath ();
+-					}
+-
++				
+ 					if (rnd == null)
+ 						rnd = new Random ();
+ 
++					// note: this property *cannot* change TempDir property
++					string temp = tempdir;
++					if (temp.Length == 0)
++						temp = GetOwnTempDir ();
++
+ 					// Create a temporary file at the target directory. This ensures
+ 					// that the generated file name is unique.
+ 					FileStream f = null;
+@@ -111,6 +112,32 @@
+ 				return(basepath);
+ 			}
+ 		}
++		
++		string GetOwnTempDir ()
++		{
++			if (ownTempDir != null)
++				return ownTempDir;
++
++			// this call ensure the Environment permissions check
++			string basedir = Path.GetTempPath ();
++			
++			// Create a subdirectory with the correct user permissions
++			int res = -1;
++			do {
++				int num = rnd.Next ();
++				num++;
++				ownTempDir = Path.Combine (basedir, num.ToString("x"));
++				if (Directory.Exists (ownTempDir))
++					continue;
++				res = mkdir (ownTempDir, 0x1c0);
++				if (res != 0) {
++					if (!Directory.Exists (ownTempDir))
++						throw new IOException ();
++					// Somebody already created the dir, keep trying
++				}
++			} while (res != 0);
++			return ownTempDir;
++		}
+ 
+ 		int ICollection.Count {
+ 			get {
+@@ -190,18 +217,25 @@
+ 		
+ 		public void Delete()
+ 		{
+-			string[] filenames=new string[filehash.Count];
+-			filehash.Keys.CopyTo(filenames, 0);
++			bool allDeleted = true;
++			string[] filenames = new string[filehash.Count];
++			filehash.Keys.CopyTo (filenames, 0);
+ 
+ 			foreach(string file in filenames) {
+ 				if((bool)filehash[file]==false) {
+ 					File.Delete(file);
+ 					filehash.Remove(file);
+-				}
++				} else
++					allDeleted = false;
+ 			}
+ 			if (basepath != null) {
+ 				string tmpFile = basepath + ".tmp";
+ 				File.Delete (tmpFile);
++				basepath = null;
++			}
++			if (allDeleted && ownTempDir != null) {
++				Directory.Delete (ownTempDir, true);
++				ownTempDir = null;
+ 			}
+ 		}
+ 
+@@ -228,5 +262,6 @@
+ 			Dispose(false);
+ 		}
+ 		
++		[DllImport ("libc")] private static extern int mkdir (string olpath, uint mode);
+ 	}
+ }


Property changes on: mono/trunk/debian/patches/fix_tmp_race_r65441.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Added: mono/trunk/debian/postinst-monoaot
===================================================================
--- mono/trunk/debian/postinst-monoaot	                        (rev 0)
+++ mono/trunk/debian/postinst-monoaot	2006-10-03 13:41:48 UTC (rev 2759)
@@ -0,0 +1,4 @@
+if [ "$1" = "configure" ]
+then
+	/usr/bin/mono --aot -O=all,shared #FILE# > /dev/null 2>&1
+fi

Added: mono/trunk/debian/prerm-monoaot
===================================================================
--- mono/trunk/debian/prerm-monoaot	                        (rev 0)
+++ mono/trunk/debian/prerm-monoaot	2006-10-03 13:41:48 UTC (rev 2759)
@@ -0,0 +1 @@
+rm -f #FILE#

Modified: mono/trunk/debian/rules
===================================================================
--- mono/trunk/debian/rules	2006-10-03 11:04:10 UTC (rev 2758)
+++ mono/trunk/debian/rules	2006-10-03 13:41:48 UTC (rev 2759)
@@ -219,6 +219,7 @@
 	dh_compress -i
 	dh_fixperms -i
 	dh_installdeb -i
+	#DH_VERBOSE=1 DH_AUTOSCRIPTDIR=$(CURDIR)/debian debian/dh_monoaot -i
 	debian/dh_makeclilibs -i -m 1.0 internal-mono
 	# APIs that may grow need tighter deps
 	debian/dh_makeclilibs \
@@ -230,7 +231,6 @@
 	  -plibmono1.0-cil \
 	  -plibmono2.0-cil \
 	  -m $(UPVERSION) internal-mono
-	#DH_VERBOSE=1 debian/dh_clideps -i internal-mono -l debian/tmp
 	debian/dh_clideps -i internal-mono -l debian/tmp
 	# mono-gac needs special runtime dep, to prevent circular dep (mono-runtime <-> mono-gac)
 	debian/dh_clideps -pmono-gac -r internal-mono




More information about the Pkg-mono-svn-commits mailing list