[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] LibreOffice packaging repository branch, ubuntu-precise-3.5, updated. libreoffice_3.5.1-1-66-g8566051



The following commit has been merged in the ubuntu-precise-3.5 branch:
commit 5384155d746ac839af7b3ff311d20f6c7e77bfad
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Mon Mar 19 20:12:10 2012 +0100

    fdo#40607 lp#817326: call fsync on write

diff --git a/patches/fdo-40607-osl_syncFile-having-written-and-avoid-doin.diff b/patches/fdo-40607-osl_syncFile-having-written-and-avoid-doin.diff
new file mode 100644
index 0000000..7d4ab37
--- /dev/null
+++ b/patches/fdo-40607-osl_syncFile-having-written-and-avoid-doin.diff
@@ -0,0 +1,173 @@
+From c6e22c0fc0cc4ce1508f8401c4b0c14fc89df942 Mon Sep 17 00:00:00 2001
+From: Michael Meeks <michael.meeks@suse.com>
+Date: Mon, 19 Mar 2012 16:31:36 +0100
+Subject: [PATCH] fdo#40607 - osl_syncFile having written, and avoid doing
+ that on start
+
+Combinded cherry-pick of master d3192948fe968fc4d6a8ec0e6fda232f265b3c4c
+plus subsequent fixes bee742eb7a0d5dfe23e61d9ee49a29286de90256 "Fix sense
+of r/o detection code, and clean up" and
+61eeb689d7605a23c3e71c652b57ee65cf5b28dc "fix smoketest - need to check
+read-only-ness of non-existent paths."
+
+Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
+---
+ desktop/source/deployment/manager/dp_manager.cxx |   84 +++++++++++----------
+ ucb/source/ucp/file/shell.cxx                    |    4 +
+ 2 files changed, 48 insertions(+), 40 deletions(-)
+
+diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
+index 508d6bb..19117ab 100644
+--- a/desktop/source/deployment/manager/dp_manager.cxx
++++ b/desktop/source/deployment/manager/dp_manager.cxx
+@@ -32,6 +32,7 @@
+ #include "dp_platform.hxx"
+ #include "dp_manager.h"
+ #include "dp_identifier.hxx"
++#include "rtl/oustringostreaminserter.hxx"
+ #include "rtl/ustrbuf.hxx"
+ #include "rtl/string.hxx"
+ #include "rtl/uri.hxx"
+@@ -312,6 +313,42 @@ void PackageManagerImpl::initRegistryBackends()
+                          m_xComponentContext ) );
+ }
+ 
++// this overcomes previous rumours that the sal API is misleading
++// as to whether a directory is truly read-only or not
++static bool isMacroURLReadOnly( const OUString &rMacro )
++{
++    rtl::OUString aDirURL( rMacro );
++    ::rtl::Bootstrap::expandMacros( aDirURL );
++
++    ::osl::FileBase::RC aErr = ::osl::Directory::create( aDirURL );
++    if ( aErr == ::osl::FileBase::E_None )
++        return false; // it will be writeable
++    if ( aErr != ::osl::FileBase::E_EXIST )
++        return true; // some serious problem creating it
++
++    bool bError;
++    sal_uInt64 nWritten = 0;
++    rtl::OUString aFileURL(
++        aDirURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/stamp.sys")) );
++    ::osl::File aFile( aFileURL );
++
++    bError = aFile.open( osl_File_OpenFlag_Read |
++                         osl_File_OpenFlag_Write |
++                         osl_File_OpenFlag_Create ) != ::osl::FileBase::E_None;
++    if (!bError)
++        bError = aFile.write( "1", 1, nWritten ) != ::osl::FileBase::E_None;
++    if (aFile.close() != ::osl::FileBase::E_None)
++        bError = true;
++    if (osl::File::remove( aFileURL ) != ::osl::FileBase::E_None)
++        bError = true;
++
++    SAL_INFO(
++        "desktop.deployment",
++        "local url '" << rMacro << "' -> '" << aFileURL << "' "
++            << (bError ? "is" : "is not") << " readonly\n");
++    return bError;
++}
++
+ //______________________________________________________________________________
+ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+     Reference<XComponentContext> const & xComponentContext,
+@@ -321,7 +358,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+         xComponentContext, context );
+     Reference<deployment::XPackageManager> xPackageManager( that );
+ 
+-    OUString packages, logFile, stampURL;
++    OUString packages, logFile, stamp;
+     if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("user") )) {
+         that->m_activePackages = OUSTR(
+             "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages");
+@@ -342,8 +379,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+         //using virtualization it appears that he/she can. Then a shared extension can
+         //be installed but is only visible for the user (because the extension is in
+         //the virtual store).
+-        stampURL = OUSTR(
+-            "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/stamp.sys");
++        stamp = OUSTR("$UNO_USER_PACKAGES_CACHE");
+     }
+     else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) {
+         that->m_activePackages = OUSTR(
+@@ -354,8 +390,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+             "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/registry");
+         logFile = OUSTR(
+             "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/log.txt");
+-        stampURL = OUSTR(
+-            "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/stamp.sys");
++        stamp = OUSTR("$UNO_SHARED_PACKAGES_CACHE");
+     }
+     else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) {
+         that->m_activePackages = OUSTR(
+@@ -394,8 +429,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+             "vnd.sun.star.expand:$TMP_EXTENSIONS");
+         that->m_registryCache = OUSTR(
+             "vnd.sun.star.expand:$TMP_EXTENSIONS/registry");
+-        stampURL = OUSTR(
+-            "vnd.sun.star.expand:$TMP_EXTENSIONS/stamp.sys");
++        stamp = OUSTR("$TMP_EXTENSIONS");
+     }
+     else if (! context.matchAsciiL(
+                  RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") )) {
+@@ -407,39 +441,9 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
+     Reference<XCommandEnvironment> xCmdEnv;
+ 
+     try {
+-        //There is no stampURL for the bundled folder
+-        if (stampURL.getLength() > 0)
+-        {
+-#define CURRENT_STAMP "1"
+-            try {
+-                //The osl file API does not allow to find out if one can write
+-                //into a folder. Therefore we try to write a file. Then we delete
+-                //it, so that it does not hinder uninstallation of OOo
+-                // probe writing:
+-                ::ucbhelper::Content ucbStamp( stampURL, xCmdEnv );
+-                ::rtl::OString stamp(
+-                    RTL_CONSTASCII_STRINGPARAM(CURRENT_STAMP) );
+-                Reference<io::XInputStream> xData(
+-                    ::xmlscript::createInputStream(
+-                        ::rtl::ByteSequence(
+-                            reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
+-                            stamp.getLength() ) ) );
+-                ucbStamp.writeStream( xData, true /* replace existing */ );
+-                that->m_readOnly = false;
+-                erase_path( stampURL, xCmdEnv );
+-            }
+-            catch (const RuntimeException &) {
+-                try {
+-                    erase_path( stampURL, xCmdEnv );
+-                } catch (...)
+-                {
+-                }
+-                throw;
+-            }
+-            catch (const Exception &) {
+-                that->m_readOnly = true;
+-            }
+-        }
++        // There is no stamp for the bundled folder:
++        if (!stamp.isEmpty())
++            that->m_readOnly = isMacroURLReadOnly( stamp );
+ 
+         if (!that->m_readOnly && logFile.getLength() > 0)
+         {
+diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
+index fcc238b..1cd1505 100644
+--- a/ucb/source/ucp/file/shell.cxx
++++ b/ucb/source/ucp/file/shell.cxx
+@@ -1913,6 +1913,10 @@ shell::write( sal_Int32 CommandId,
+         }
+     } while( nReadBytes == nRequestedBytes );
+ 
++    aFile.sync(); // fsync / flush it to disk.
++    OSL_TRACE( "fsync'd file '%s'\n",
++               rtl::OUStringToOString( aUnqPath, RTL_TEXTENCODING_UTF8 ).getStr() );
++
+     err = aFile.close();
+     if( err != osl::FileBase::E_None  )
+     {
+-- 
+1.7.9.1
+
diff --git a/patches/series b/patches/series
index c778235..f78bb59 100644
--- a/patches/series
+++ b/patches/series
@@ -36,3 +36,4 @@ prevent-sax-obsolete-dir.diff
 pkgconfig-mozilla-plugin.diff
 ubuntu-quicklists.diff
 fix-for-kdelibs-enum.diff
+fdo-40607-osl_syncFile-having-written-and-avoid-doin.diff

-- 
LibreOffice packaging repository


Reply to: