Bug 104412 - DirectoryNameoutofPath no longer works
Summary: DirectoryNameoutofPath no longer works
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.4.0 target:5.3.0.1 target:5.2.6
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2016-12-05 09:43 UTC by Alex Kempshall
Modified: 2017-01-20 08:58 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
bisect log (1.68 KB, text/x-log)
2016-12-05 14:55 UTC, Alex Kempshall
Details
Proposed patch for wizards/source/tools/Strings.xba (557 bytes, patch)
2016-12-05 16:25 UTC, Alex Kempshall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Kempshall 2016-12-05 09:43:29 UTC
I use this code in a macro. 

sub GetFileName_001()

	Dim strDirectoryName as String
    	
	If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
	   GlobalScope.BasicLibraries.LoadLibrary("Tools")
	End If
	
	Msgbox (" Host file is " & ThisComponent.getURL())
	
	strDirectoryName = DirectoryNameoutofPath(ThisComponent.getURL(), "/") & "/"
	
	MsgBox( "Host directory is " & strDirectoryName)
	
end sub


It fails at the step 

strDirectoryName = DirectoryNameoutofPath(ThisComponent.getURL(), "/") & "/"

with a message box with the text 

"BASIC runtime error.
Incorrect property value."


This is a recent problem. Possibly within the last two weeks.


Alex
Comment 1 Alex Kempshall 2016-12-05 14:55:45 UTC
Created attachment 129324 [details]
bisect log
 379b7ffb68bed5bc376a91032a781be147a6eff1 is the first bad commit
commit 379b7ffb68bed5bc376a91032a781be147a6eff1
Author: Pierre Lepage <pierrelepage3@gmail.com>
Date:   Sat Nov 5 14:52:44 2016 -0400

    tdf#80731 Closing parenthesis is now detected (Mid statement and functions).
    
    Change-Id: I5efdb6c3ce71148672a8b76d3f1cc87b0fe04994
    Reviewed-on: https://gerrit.libreoffice.org/30593
    Tested-by: Julien Nabet <serval2412@yahoo.fr>
    Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>

:040000 040000 c405fe4479462adde5eeb0537af3f8758a77c998 56df2a2e79580ea3d676505bd3d31b64bb2725b4 M	basic
Comment 2 Alex Kempshall 2016-12-05 15:17:06 UTC
Problem is most likely to be a side effect of this commit. 

Navigating to the Tools library 

Tools -> Macros -> Organise Macros -> LibreOffice Basic -> LibreOffice Macros -> Tools -> Strings

I get an error message about a missing bracket.

If I then inspect the code in LO 5.1.5 via the Tools macro GetFileNameWithoutExtension  that immediately precedes the failing DirectoryNameoutofPath I see a missing bracket in the last line of that macro GetFileNameWithoutExtension

The line 

GetFileNameWithoutExtension = RTrimStr(FileName, "." & SepList(MaxIndex)

should be

GetFileNameWithoutExtension = RTrimStr(FileName, "." & SepList(MaxIndex))

This missing bracket has probably been missing for some considerable period of time without any nasty side effects. However, with the introduction of this change has now become an issue.
Comment 3 Alex Kempshall 2016-12-05 16:25:18 UTC
Created attachment 129330 [details]
Proposed patch for wizards/source/tools/Strings.xba

All it does is add the missing bracket. Suppose I'll have to go down the gerrit route. Better get registering.
Comment 4 Xisco Faulí 2016-12-05 20:02:06 UTC
Hello Alex,

Thanks for reporting, bisecting and fixing this bug, that's fantastic.
Please submit the patch to gerrit as this is the stadard procedure we follow in the project.
Setting it to NEW
Comment 5 Commit Notification 2016-12-06 15:49:21 UTC
Alex McMurchy1917 committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=08befaceb65bf2f0f0e8ec976f7826be8f5dd7d7

Fixes tdf#104412 - DirectoryNameoutofPath no longer works

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2016-12-07 08:51:54 UTC
Alex McMurchy1917 committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b1f739b2bc227f81b1ec740e05927e866fa81d94&h=libreoffice-5-3

Fixes tdf#104412 - DirectoryNameoutofPath no longer works

It will be available in 5.3.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2017-01-20 08:58:18 UTC
Alex McMurchy1917 committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bf7f3c0baabf0a8e74687ca192ff59c8f3d06207&h=libreoffice-5-2

Fixes tdf#104412 - DirectoryNameoutofPath no longer works

It will be available in 5.2.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.