Bug 142917 - FileExists returns False for hidden files.
Summary: FileExists returns False for hidden files.
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-17 13:23 UTC by Andreas Säger
Modified: 2021-06-18 12:53 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with macro (13.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-06-18 09:49 UTC, Andreas Säger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Säger 2021-06-17 13:23:00 UTC
StarBasic function FileExists("file:///tmp/test/.foo") always returns False even if .foo definitively exists. 
Expected behaviour: return True if file exists.

Tested with LO 6.0 (Ubuntu 18.4 ppa) and 7.1 and with AOO 4.1. Works as expected with OpenOffice.
Comment 1 [REDACTED] 2021-06-17 13:50:20 UTC
No repro

Version: 7.1.4.2 / LibreOffice Community
Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 Andreas Säger 2021-06-17 17:41:24 UTC
Indeed, it works with a regular dummy file URL file:///tmp/test/.foo and I must have made some mistake when testing that URL.

However, my original intention was this:

print fileExists("file:///tmp/test/.~lock.test.ods#")
which detects a lock file for /tmp/test/test,ods when used with AOO but not LO.

print fileExists("/tmp/test/.~lock.test.ods#") works with LO too. So it has something to do with URL notation vs system notation.
Comment 3 [REDACTED] 2021-06-18 08:44:27 UTC
repro if using file name ".~lock.test.ods#"

Further investigation: It seems that "#" (hash) at the end of the file name is the culprit. Whenever there is no "#" then function FileExists() works.
Comment 4 Andreas Säger 2021-06-18 09:49:28 UTC
Created attachment 172995 [details]
Spreadsheet with macro

When opened in edit mode the macro detects a lock file and reports "True".
Comment 5 Andreas Säger 2021-06-18 09:52:25 UTC
This bug report is invalid because LO is right. The correct URL of a lock file looks like file:///path/.~lock.test.ods%23 which is also accepted by AOO. AOO seems to be a little bit more generous in respect to valid URLs.
Comment 6 Michael Warner 2021-06-18 12:53:31 UTC
Based on Comment 5, I am marking this as NOTABUG.