diff --git a/libreoffice-4.3.0.3-themes-symlinks.patch b/libreoffice-4.3.0.3-themes-symlinks.patch new file mode 100644 index 0000000..238c412 --- /dev/null +++ b/libreoffice-4.3.0.3-themes-symlinks.patch @@ -0,0 +1,167 @@ +From c796db004d463cb60a5b4489a868ae8dd377d0df Mon Sep 17 00:00:00 2001 +From: Tobias Lippert +Date: Sat, 19 Jul 2014 13:39:21 +0200 +Subject: [PATCH] fdo#81532 Handle symlinks to icon themes correctly + +- added logging for icon theme scanning. + +Change-Id: I799c5fc09879411020142f7808da0d9f2f63dc17 +--- + vcl/source/app/IconThemeScanner.cxx | 68 ++++++++++++++++++++++------------- + 1 file changed, 43 insertions(+), 25 deletions(-) + +diff --git a/vcl/source/app/IconThemeScanner.cxx b/vcl/source/app/IconThemeScanner.cxx +index 9684bb6..29d3cd7 100644 +--- a/vcl/source/app/IconThemeScanner.cxx ++++ b/vcl/source/app/IconThemeScanner.cxx +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -20,24 +21,34 @@ namespace vcl { + + namespace { + +-bool +-search_path_is_valid(const OUString& dir) ++const char *LOG_AREA = "vcl.app"; ++ ++// set the status of a file. Returns false if the status could not be determined. ++bool set_file_status(osl::FileStatus& status, const OUString& file) + { + osl::DirectoryItem dirItem; +- osl::FileBase::RC retvalGet = osl::DirectoryItem::get(dir, dirItem); ++ osl::FileBase::RC retvalGet = osl::DirectoryItem::get(file, dirItem); + if (retvalGet != osl::FileBase::E_None) { ++ SAL_WARN(LOG_AREA, "Could not determine status for file '" << file << "'."); + return false; + } +- osl::FileStatus fileStatus(osl_FileStatus_Mask_Type); +- osl::FileBase::RC retvalStatus = dirItem.getFileStatus(fileStatus); ++ osl::FileBase::RC retvalStatus = dirItem.getFileStatus(status); + if (retvalStatus != osl::FileBase::E_None) { ++ SAL_WARN(LOG_AREA, "Could not determine status for file '" << file << "'."); + return false; + } ++ return true; ++} + +- if (!fileStatus.isDirectory()) { +- return false; ++OUString convert_to_absolute_path(const OUString& path) ++{ ++ salhelper::LinkResolver resolver(0); ++ osl::FileBase::RC rc = resolver.fetchFileStatus(path); ++ if (rc != osl::FileBase::E_None) { ++ SAL_WARN(LOG_AREA, "Could not resolve path '" << path << "' to search for icon themes."); ++ throw std::runtime_error("Provided a recursive symlink to a icon theme directory that could not be resolved."); + } +- return true; ++ return resolver.m_aStatus.getFileURL(); + } + + } +@@ -48,12 +59,20 @@ IconThemeScanner::IconThemeScanner() + bool + IconThemeScanner::ScanDirectoryForIconThemes(const OUString& path) + { +- bool pathIsValid = search_path_is_valid(path); +- if (!pathIsValid) { ++ osl::FileStatus fileStatus(osl_FileStatus_Mask_Type); ++ bool couldSetFileStatus = set_file_status(fileStatus, path); ++ if (!couldSetFileStatus) { ++ return false; ++ } ++ ++ if (!fileStatus.isDirectory()) { ++ SAL_INFO(LOG_AREA, "Cannot search for icon themes in '"<< path << "'. It is not a directory."); + return false; + } ++ + std::vector iconThemePaths = ReadIconThemesFromPath(path); + if (iconThemePaths.empty()) { ++ SAL_WARN(LOG_AREA, "Could not find any icon themes in the provided directory ('" < found; ++ SAL_INFO(LOG_AREA, "Scanning directory '" << dir << " for icon themes."); + + osl::Directory dirToScan(dir); + osl::FileBase::RC retvalOpen = dirToScan.open(); +@@ -93,15 +116,12 @@ IconThemeScanner::ReadIconThemesFromPath(const OUString& dir) + if (retvalStatus != osl::FileBase::E_None) { + continue; + } +- if (!status.isRegular()) { +- continue; +- } +- if (!FileIsValidIconTheme(status.getFileURL())) { ++ ++ OUString filename = convert_to_absolute_path(status.getFileURL()); ++ if (!FileIsValidIconTheme(filename)) { + continue; + } +- OUString entry; +- entry = status.getFileURL(); +- found.push_back(entry); ++ found.push_back(filename); + } + return found; + } +@@ -111,20 +131,16 @@ IconThemeScanner::FileIsValidIconTheme(const OUString& filename) + { + // check whether we can construct a IconThemeInfo from it + if (!IconThemeInfo::UrlCanBeParsed(filename)) { ++ SAL_INFO(LOG_AREA, "File '" << filename << "' does not seem to be an icon theme."); + return false; + } + +- // check whether the file is a regular file +- osl::DirectoryItem dirItem; +- osl::FileBase::RC retvalGet = osl::DirectoryItem::get(filename, dirItem); +- if (retvalGet != osl::FileBase::E_None) { +- return false; +- } + osl::FileStatus fileStatus(osl_FileStatus_Mask_Type); +- osl::FileBase::RC retvalStatus = dirItem.getFileStatus(fileStatus); +- if (retvalStatus != osl::FileBase::E_None) { ++ bool couldSetFileStatus = set_file_status(fileStatus, filename); ++ if (!couldSetFileStatus) { + return false; + } ++ + if (!fileStatus.isRegular()) { + return false; + } +@@ -178,6 +194,8 @@ IconThemeScanner::GetIconThemeInfo(const OUString& themeId) + std::vector::iterator info = std::find_if(mFoundIconThemes.begin(), mFoundIconThemes.end(), + SameTheme(themeId)); + if (info == mFoundIconThemes.end()) { ++ SAL_WARN(LOG_AREA, "Requested information for icon theme with id '" << themeId ++ << "' which does not exist."); + throw std::runtime_error("Requested information on not-installed icon theme"); + } + return *info; +-- +1.7.9.5 + diff --git a/libreoffice.changes b/libreoffice.changes index 5c4e181..51ff4b0 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jul 21 07:09:41 UTC 2014 - tchvatal@suse.com + +- Add patch to fix the themes/icons handling: + * libreoffice-4.3.0.3-themes-symlinks.patch + ------------------------------------------------------------------- Mon Jul 21 06:58:44 UTC 2014 - tchvatal@suse.com diff --git a/libreoffice.spec b/libreoffice.spec index 3c3a7ac..75ca881 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -87,6 +87,7 @@ Patch11: nlpsolver-no-broken-help.diff Patch12: mediawiki-no-broken-help.diff # LO never worked well with it Patch13: jvmfwk-disable-gcj.diff +Patch14: libreoffice-4.3.0.3-themes-symlinks.patch # Fix running wizards in py2 as the utf is not there Patch16: wizards-create-temlates-with-python-2.6.diff # try to save space by using hardlinks @@ -850,6 +851,7 @@ Provides additional %{langname} translations and resources for %{project}. \ %patch11 %patch12 %patch13 -p1 +%patch14 -p1 %patch16 -p1 %patch990 -p1 # 256x256 icons