Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


A two-day-old clone of branch libreoffice-3-4 fails to build module
sal with dblevel=2, unittest fails: osl_old_test_file.cxx assertion
"#failure 1.1": the failure is that blah/a/.. is not transformed to
"blah", but stays "blah/a/.."

That's because in my setup symlinks are allowed, and in that setup
osl_getAbsoluteFileURL does not touch the last component (the part
after the last slash).

The attached patch changes that to _still_ treating the special names
"." and "..": they cannot be symlinks, so they don't have to be
protected against treatment and we want them treated.

-- 
Lionel
From 9a5d3dddb140912daba08927fb1d58d3516d60f3 Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <lionel@mamane.lu>
Date: Thu, 4 Aug 2011 11:42:29 +0200
Subject: [PATCH] osl_getAbsoluteFileURL symlinks allowed: ".", ".." still treated

---
 sal/osl/unx/file_url.cxx |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 21fbe37..7caabcd 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -722,7 +722,9 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString*  ustrBaseDirURL, rtl_uString* u
         rtl::OUString base;
         sal_Int32 last_slash = unresolved_path.lastIndexOf( UNICHAR_SLASH );
 
-        if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength())
+        if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength()
+            && ! ( last_slash + 2 == unresolved_path.getLength() && 
unresolved_path.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("."), last_slash + 1) )
+            && ! ( last_slash + 3 == unresolved_path.getLength() && 
unresolved_path.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(".."), last_slash + 1) ))
         {
             base = unresolved_path.copy(last_slash+1);
             unresolved_path = unresolved_path.copy(0, last_slash);
-- 
1.7.2.5


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.