--- kernel/classes/ezpackage.php.org	2009-08-24 11:09:00.000000000 +0200
+++ kernel/classes/ezpackage.php	2009-08-24 15:09:03.000000000 +0200
@@ -1189,7 +1189,24 @@
                 {
                     eZDir::mkdir( $packagePath, false, true );
                 }
-                $archive->extract( $packagePath );
+                //$archive->extract( $packagePath );
+                // Search for the files we want to extract
+                $archive->rewind();
+                foreach( $archive as $entry )
+                {
+                    $fileName = $entry->getPath();
+                    if ( !$archive->extractCurrent( $packagePath ) )
+                    {
+                        eZDebug::writeError( "Failed extracting file in package into $packagePath" );
+                        return false;
+                    } else
+                    {
+                        if( $entry->isDirectory() )
+                            self::applyStorageDirPermissions( $packagePath . '/' . $fileName );
+                        else
+                            self::applyStorageFilePermissions( $packagePath . '/' . $fileName );
+                    }
+                }
 
                 $package = eZPackage::fetch( $packageName, $fullRepositoryPath, false, $dbAvailable );
                 if ( !$package )
@@ -1243,6 +1260,16 @@
     }
 
     /*!
+     Applies the storage dir permissions specified in site.ini to the directory \a $dirname
+    */
+    static function applyStorageDirPermissions( $dirname )
+    {
+        $siteConfig = eZINI::instance( 'site.ini' );
+        $dirPermissions = $siteConfig->variable( 'FileSettings', 'StorageDirPermissions');
+        chmod( $dirname, octdec( $dirPermissions ) );
+    }
+
+    /*!
      Stores the DOM tree \a $dom to the file \a $filename.
     */
     static function storeDOM( $filename, $dom )
