Bug 147280 - lang pack installer cannot find base installation of libreoffice on macos if spotlight is disabled or not indexed fully
Summary: lang pack installer cannot find base installation of libreoffice on macos if ...
Status: RESOLVED DUPLICATE of bug 144053
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Installation (show other bugs)
Version:
(earliest affected)
7.3.0.3 release
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Language-Help-Packs
  Show dependency treegraph
 
Reported: 2022-02-08 09:37 UTC by Arkadiusz Miśkiewicz
Modified: 2023-02-19 21:56 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arkadiusz Miśkiewicz 2022-02-08 09:37:06 UTC
Description:
When installing language pack on a system which has main libreoffice already installed and spotlight is DISABLED from beginning the installer reports that it is unable to find main installation directory and wants me to point to it manually. When I do that it says that this directory is not correct libreoffice installation dir. (I have all these messages in polish).

The reason for that is that libreoffice installed relies on spotlight working.
Spotlight is causing my macbook pro to be hot as hell, so the first thing I do is to disable it.

Now installer uses internally mdfind which uses spotlight database.

Obviously that ends up with disaster.

md* won't be able to find anything new that is not already indexed by spotlight.


arekm@amb ~ % mdutil -s /Applications/
/System/Volumes/Data/Applications:
	Indexing disabled.

And indeed:

arekm@amb ~ % mdfind "kMDItemContentType =='com.apple.application-bundle' && kMDItemDisplayName == 'LibreOffice.app'"
arekm@amb ~ % mdls /Applications/LibreOffice.app
kMDItemFSContentChangeDate = 2021-08-16 23:51:29 +0000
kMDItemFSCreationDate      = 2021-08-16 23:51:29 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "LibreOffice.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 80
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 1
kMDItemFSTypeCode          = ""


Why not iterate over /Applications/*.app (or just check /Applications/LibreOffice*.app), check interesting parts + still do mdfind solution, so there are more changes to get this working?


That would work for both group of people, those with spotlight enabled and also disabled.


Tested on 7.3.0.3 and macos 12.2.

Steps to Reproduce:
1. disable spotlight and wipe out its database (don't have procedure for that - mine spotlight was disabled from beginning; sudo mdutil -E / probably)
2. install libreoffice main 7.0 (had en-US version)
3. try to install lang pack for any language (pl-PL in my case)

Actual Results:
lang pack installer not finding installation dir and manually pointed directory is not recognized as valid

Expected Results:
It should:
- automatically find correct dir
- properly recognize manually pointed dir as libreoffice installation


Reproducible: Always


User Profile Reset: No



Additional Info:
Don't rely on md* utils ONLY. These REQUIRE spotlight working and properly indexed. Just use plain and reliable iteration over directory etc.
Comment 1 Alex Thurgood 2022-02-09 17:09:23 UTC
Can't/won't test as I deliberately index all of my disk content as I find it incredibly useful when searching for files.

I can sympathize with your request, but perhaps the use of mdfind is the Apple-recommended method rather than some fragile script grepping that might break at a future date ?

Note that I'm not the one who decides here, I'm just a triager and user.
Comment 2 Arkadiusz Miśkiewicz 2022-02-09 20:00:39 UTC
Changing script to make

mdfind "kMDItemContentType =='com.apple.application-bundle' && kMDItemDisplayName == 'LibreOffice.app'"

return nothing is a simple way to reproduce without playing with disabling spotlight.

Anyway I would go with simplest approach. If spotlight is disabled then mdfind won't find anything. User will be required to point to LibreOffice.app manually and what is needed is to make verification of that directory also working in spotlight-disabled environment.

Code for that is:

-- now only check whether the path is really from LibreOffice
try
        do shell script "mdls --raw --name kMDItemFSName --name kMDItemVersion " & quoted form of (choice as string) & " | xargs -0 | fgrep 'LibreOffice.app 7.3'"
on error
        display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0
        return 3 --wrong target-directory
end try


"mdls  /Applications/LibreOffice.app" on spotlight disabled system doesn't show "kMDItemVersion"

On mine it is:

arekm@amb ~ % mdls  /Applications/LibreOffice.app
kMDItemFSContentChangeDate = 2022-01-26 18:34:37 +0000
kMDItemFSCreationDate      = 2022-01-26 18:34:37 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "LibreOffice.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 80
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 1
kMDItemFSTypeCode          = ""
arekm@amb ~ %

so

% mdls --raw --name kMDItemFSName --name kMDItemVersion /Applications/LibreOffice.app
LibreOffice.app(null)%
arekm@amb ~ %

Maybe change this condition to be like (pseudo apple script since I don't know it) :

if

"mdls --raw --name kMDItemFSName --name kMDItemVersion " & quoted form of (choice as string) & " | xargs -0 | fgrep 'LibreOffice.app 7.3'"

OR

(
  "defaults read " & quoted form of (choice as string) & 
  "/LibreOffice.app/Contents/Info CFBundleName == "LibreOffice"

  AND

  defaults read  " & quoted form of (choice as string) & 
  "/LibreOffice.app/Contents/Info CFBundleVersion | xargs -0 | fgrep "^7.3'"

)

That would work for both cases, with and without spotlight.
Comment 3 Arkadiusz Miśkiewicz 2022-02-09 20:02:30 UTC
I mean:

defaults read " & quoted form of (choice as string) & "/Contents/Info
Comment 4 Arkadiusz Miśkiewicz 2022-02-09 20:20:46 UTC
And for reference, "defaults" retruns these for me:

arekm@amb ~ % defaults read /Applications/LibreOffice.app/Contents/Info CFBundleName
LibreOffice
arekm@amb ~ % defaults read /Applications/LibreOffice.app/Contents/Info CFBundleVersion
7.3.0.3
Comment 5 Alex Thurgood 2022-02-10 11:08:47 UTC
@cloph : what do you think ?
Comment 6 Wim M 2022-03-05 12:22:33 UTC
*** Bug 147138 has been marked as a duplicate of this bug. ***
Comment 7 Arkadiusz Miśkiewicz 2022-12-18 21:57:38 UTC
Was just testing if anything has changed but no.

7.4.3.2 is buggy.

Still unreliable mdfind is used:

% mdfind "kMDItemContentType =='com.apple.application-bundle' && kMDItemDisplayName == 'LibreOffice.app'"


While the LibreOffice is installed:

% mdls  /Applications/LibreOffice.app
kMDItemFSContentChangeDate = 2022-11-18 02:03:10 +0000
kMDItemFSCreationDate      = 2022-11-18 02:03:10 +0000
kMDItemFSCreatorCode       = ""
kMDItemFSFinderFlags       = 0
kMDItemFSHasCustomIcon     = 0
kMDItemFSInvisible         = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery      = 0
kMDItemFSLabel             = 0
kMDItemFSName              = "LibreOffice.app"
kMDItemFSNodeCount         = 1
kMDItemFSOwnerGroupID      = 80
kMDItemFSOwnerUserID       = 501
kMDItemFSSize              = 1
kMDItemFSTypeCode          = ""
%
Comment 8 Wim M 2023-01-17 15:56:44 UTC
I experienced a version of this bug today when installing the most recent RC 7.5.0.2 on Monterey. The langpack installer did not recognise my freshly installed app bundle (I had started it once after installation). After a reboot, installation of the language pack went smoothly.

I don't think I have experienced it before on the computer on which I installed today, although I have an older Mac running Big Sur on which rebooting after an LO installation is usually necessary in order to install the language pack.

Version: 7.5.0.2 (X86_64) / LibreOffice Community
Build ID: c0dd1bc3f1a385d110b88e26ece634da94921f58
CPU threads: 8; OS: Mac OS X 12.6.2; UI render: Skia/Metal; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Calc: threaded
Comment 9 Stéphane Guillou (stragu) 2023-02-19 14:21:40 UTC
*** Bug 153395 has been marked as a duplicate of this bug. ***
Comment 10 Stéphane Guillou (stragu) 2023-02-19 21:35:55 UTC
Changing first affected version to 7.3.0.3 as it's the earliest mentioned here.
Comment 11 Stéphane Guillou (stragu) 2023-02-19 21:56:20 UTC

*** This bug has been marked as a duplicate of bug 144053 ***