[Libreoffice-bugs] [Bug 144405] New: cli_cppuhelper policy installed in GAC for wrong architecture

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Sep 9 10:42:13 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=144405

            Bug ID: 144405
           Summary: cli_cppuhelper policy installed in GAC for wrong
                    architecture
           Product: LibreOffice
           Version: 7.2.0.4 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Installation
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: Kalle.Niemitalo at procomp.fi

Description:
LibreOffice_7.2.0_Win_x64.msi (LibreOffice 7.2.0.4) on Windows 10 x64 installs
CLI Language Binding assemblies to the Global Assembly Cache.  The problem is
that policy.1.0.cli_cppuhelper is installed to GAC_32 but cli_cppuhelper itself
is installed to GAC_64.  A .NET Framework x64 application that references
cl_cppuhelper will then ignore the policy and fail to load cli_cppuhelper from
the GAC unless the application references exactly the installed version.

Steps to Reproduce:
1. Install LibreOffice_7.2.0_Win_x64.msi on Windows 10 x64.  (Do not install
the 32-bit version.)
2. Start Windows PowerShell 5.1 (64-bit).  (Do not use PowerShell Core 6 or
PowerShell 7, because those do not run on .NET Framework.)
3. Execute in PowerShell: [System.Reflection.Assembly]::Load("cli_cppuhelper,
Version=1.0.22.0, Culture=neutral, PublicKeyToken=ce2cb7e279207b9e,
processorArchitecture=AMD64")

Actual Results:
.NET Framework ignores the binding redirection in policy.1.0.cli_cppuhelper and
tries to load version 1.0.22.0, which has not been installed:

Exception calling "Load" with "1" argument(s): "Could not load file or assembly
'cli_cppuhelper, Version=1.0.22.0, Culture=neutral,
PublicKeyToken=ce2cb7e279207b9e' or one of its dependencies. The system cannot
 find the file specified."
At line:1 char:1
+ [System.Reflection.Assembly]::Load("cli_cppuhelper, Version=1.0.22.0, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

Expected Results:
.NET Framework should use the binding redirection in policy.1.0.cli_cppuhelper
and load version 1.0.23.0 instead:

GAC    Version        Location
---    -------        --------
True   v4.0.30319    
C:\WINDOWS\Microsoft.Net\assembly\GAC_64\cli_cppuhelper\v4.0_1.0.23.0__ce2cb7e279207b9e\cli_cppuhelper.dll


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.0.4 (x64) / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Vulkan; VCL: win
Locale: fi-FI (fi_FI); UI: en-US
Calc: threaded

policy.1.0.cli_cppuhelper is in GAC_32 but cli_cppuhelper itself is in GAC_64:

C:\>dir /s /b C:\Windows\Microsoft.NET\assembly\*cli_*.dll
C:\Windows\Microsoft.NET\assembly\GAC_32\policy.1.0.cli_cppuhelper\v4.0_23.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_cppuhelper.dll
C:\Windows\Microsoft.NET\assembly\GAC_64\cli_cppuhelper\v4.0_1.0.23.0__ce2cb7e279207b9e\cli_cppuhelper.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\cli_basetypes\v4.0_1.0.20.0__ce2cb7e279207b9e\cli_basetypes.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\cli_oootypes\v4.0_1.0.9.0__ce2cb7e279207b9e\cli_oootypes.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\cli_ure\v4.0_1.0.23.0__ce2cb7e279207b9e\cli_ure.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\cli_uretypes\v4.0_1.0.9.0__ce2cb7e279207b9e\cli_uretypes.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.1.0.cli_basetypes\v4.0_20.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_basetypes.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.1.0.cli_oootypes\v4.0_9.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_oootypes.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.1.0.cli_ure\v4.0_23.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_ure.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.1.0.cli_uretypes\v4.0_9.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_uretypes.dll

policy.1.0.cli_cppuhelper contains this binding redirection:

      <dependentAssembly>
        <assemblyIdentity name="cli_cppuhelper"
publicKeyToken="ce2cb7e279207b9e"/>
        <bindingRedirect oldVersion="1.0.0.0-1.0.22.0" newVersion="1.0.23.0" />
      </dependentAssembly>

When .NET Framework tries to load e.g. version 1.0.22.0 of cli_cppuhelper, this
policy should make it load version 1.0.23.0 instead. However, it does not take
effect in x64 processes because the policy is in the wrong directory.
Therefore, a .NET Framework x64 application that references cl_cppuhelper will
fail to load it from the GAC unless the application references exactly the
installed version.

I have found two mistakes in the setup:

1. The policy.1.0.cli_cppuhelper.dll file has been built for x86; its CLR
header has the 32BITREQUIRED flag, and evaluating
[System.Reflection.AssemblyName]::GetAssemblyName("C:\Windows\Microsoft.NET\assembly\GAC_32\policy.1.0.cli_cppuhelper\v4.0_23.0.0.0__ce2cb7e279207b9e\policy.1.0.cli_cppuhelper.dll").ProcessorArchitecture
in Windows PowerShell 5.1 returns X86. (In contrast, the same for
"C:\Windows\Microsoft.NET\assembly\GAC_64\cli_cppuhelper\v4.0_1.0.23.0__ce2cb7e279207b9e\cli_cppuhelper.dll"
returns Amd64.) I don't know which file in the source tree specifies the
incorrect architecture for this.

2. ORCA shows that the MsiAssemblyName table of the MSI package has
processorArchitecture=x86 for both cli_cppuhelper and
policy.1.0.cli_cppuhelper. These should be amd64 instead. This mismatch does
not seem to affect where Fusion installs the files, but it may prevent gacutil
/lr cli_cppuhelper from showing that the assembly is referenced by a Windows
Installer package. I suspect this mismatch originates from
scp2/source/ooo/ure.scp, which unconditionally specifies ProcessorArchitecture
= "x86" for both gid_File_Lib_Cli_Cppuhelper_Assembly and
gid_File_Lib_Policy_Cli_Cppuhelper_Assembly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210909/766207b5/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list