.gitignore | 5 - desktop/source/deployment/manager/dp_manager.cxx | 84 ++++++++++++----------- ucb/source/ucp/file/shell.cxx | 4 + 3 files changed, 48 insertions(+), 45 deletions(-)
New commits: commit 5eceb03e2b756595d83550a6d662d789aec83e90 Author: Norbert Thiebaud <nthieb...@gmail.com> Date: Sat Feb 18 18:40:42 2012 -0600 do not hide patch-related file (.orig .rej) If you want to hide them, add the rule in you local git set-up. see git config --global core.excludesfiles fo more info Signed-off-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/.gitignore b/.gitignore index caf15fb..5999b94 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,6 @@ /aclocal.m4 /autom4te.cache /autogen.lastrun -/build_env /ChangeLog /config.guess /config.log @@ -119,10 +118,6 @@ test/user-template/user/psprint/pspfontcache # LibreOffice lock files .~lock.*# -# Everyone loves patching -*.orig -*.rej - # Somepeople love debugging gdbtrace.log valgrind.log commit c6e22c0fc0cc4ce1508f8401c4b0c14fc89df942 Author: Michael Meeks <michael.me...@suse.com> Date: Mon Mar 19 16:31:36 2012 +0100 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 <sberg...@redhat.com> 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 ) { _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits