Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable Installers does not work with .cmd #3807

Closed
blaubaer opened this issue Oct 24, 2023 · 5 comments
Closed

Portable Installers does not work with .cmd #3807

blaubaer opened this issue Oct 24, 2023 · 5 comments
Labels
Resolution-Duplicate Issue is a duplicate
Milestone

Comments

@blaubaer
Copy link

Brief description of your issue

While working on winget-pkgs#123118 I found some unexpected behaviors by creating a portable installer that is containing a .cmd file as executable.

BTW: I've added already an idea to tackle a part of this issue in the ticket #3749.

Steps to reproduce

  1. Create a manifest with a portable installer that is containing .cmd/.bat executables:

    Apache.Maven.installer.yaml

    PackageIdentifier: Apache.Maven
    PackageVersion: 3.9.5
    MinimumOSVersion: 10.0.0.0
    InstallerType: zip
    Installers:
      - Architecture: neutral
        InstallerUrl: https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.zip
        InstallerSha256: 7822eb593d29558d8edf87845a2c47e36e2a89d17a84cd2390824633214ed423
        NestedInstallerType: portable
        NestedInstallerFiles:
        - RelativeFilePath: apache-maven-3.9.5\bin\mvn.cmd
          PortableCommandAlias: mvn
    ManifestType: installer
    ManifestVersion: 1.5.0

    Apache.Maven.locale.en-US.yaml

    PackageIdentifier: Apache.Maven
    PackageVersion: 3.9.5
    PackageLocale: en-US
    Publisher: Apache Software Foundation
    PublisherUrl: https://apache.org
    PackageName: Apache Maven
    PackageUrl: https://maven.apache.org/
    License: Apache License 2.0
    LicenseUrl: https://github.com/apache/maven/blob/master/LICENSE
    ShortDescription: Apache Maven is a software project ...
    ReleaseNotesUrl: https://maven.apache.org/docs/3.9.5/release-notes.html
    ManifestType: defaultLocale
    ManifestVersion: 1.5.0

    Apache.Maven.yaml

    PackageIdentifier: Apache.Maven
    PackageVersion: 3.9.5
    DefaultLocale: en-US
    ManifestType: version
    ManifestVersion: 1.5.0
  2. Call winget install --manifest <path_to_manifest> with elevated permissions.

Expected behavior

  1. I can normally call now either mvn or mvn.cmd.
  2. Automatic validation for winget-pkgs is able to execute mvn.cmd.

Actual behavior

  1. In %USERPROFILE%\AppData\Local\Microsoft\WinGet\Links there is a file generated named mvn.exe (instead of mvn.cmd) which points to %USERPROFILE%AppData\Local\Microsoft\WinGet\Packages\Apache.Maven__DefaultSource\apache-maven-3.9.5\bin\mvn.cmd.

  2. Automatic Validation of winget-pkgs failed with

    Exception during executable launch operation System.AggregateException: One or more errors occurred. (The specified executable is not a valid application for this OS platform.) ---
    

ℹ️ Please explicitly ignore the fact, that the mvn.cmd does require a provided JAVA_HOME for this ticket.

Environment

Windows-Paket-Manager (Vorschau) v1.7.2782-preview
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.22621.2428
Systemarchitektur: X64
Paket: Microsoft.DesktopAppInstaller v1.22.2782.0

WinGet-Verzeichnisse
-----------------------------------------------------------------------------------------------------------------------------------------
Protokolle                                   %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
Benutzereinstellungen                        %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Verzeichnis für portierbare Links (Benutzer) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portables Linkverzeichnis (Computer)         C:\Program Files\WinGet\Links
Portierbarer Paketstamm (Benutzer)           %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portierbarer Paketstamm                      C:\Program Files\WinGet\Packages
Portierbares Paketstamm (x86)                C:\Program Files (x86)\WinGet\Packages
Installationsprogrammdownloads               %USERPROFILE%\Downloads

Links
-----------------------------------------------------------------------------------------
Datenschutzerklärung              https://aka.ms/winget-privacy
Lizenzvereinbarung                https://aka.ms/winget-license
Hinweise von Drittanbietern       https://aka.ms/winget-3rdPartyNotice
Startseite                        https://aka.ms/winget
Windows Store-Nutzungsbedingungen https://www.microsoft.com/en-us/storedocs/terms-of-sale

Administratoreinstellung                  Status
-----------------------------------------------------
LocalManifestFiles                        Aktiviert
BypassCertificatePinningForMicrosoftStore Deaktiviert
InstallerHashOverride                     Deaktiviert
LocalArchiveMalwareScanOverride           Aktiviert
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Oct 24, 2023
@Trenly
Copy link
Contributor

Trenly commented Oct 24, 2023

@microsoft-github-policy-service
Copy link
Contributor

Hello @blaubaer,

We've identified this as a duplicate of another issue or PR that already exists. This specific instance is being closed in favor of the linked issue. Please add your 👍 to the other issue to raise its priority. Thanks for your contribution!

Template: msftbot/duplicate/closed

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-Duplicate Issue is a duplicate and removed Needs-Triage Issue need to be triaged labels Oct 24, 2023
@blaubaer
Copy link
Author

@Trenly This is not really a duplicate of #3386, because .cmd and .bat files are considered as somehow executable in the context of Windows (although they're not .exe files directly). This ticket does not refer to start a .jar file or similar.

@Trenly
Copy link
Contributor

Trenly commented Oct 24, 2023

As the title of the other issue states "Portable Executables not supported for non-exe targets". As you stated, .cmd and .bat are executables; ergo, they are a non-exe target which is a portable executable.

Although the body of the other issue only specifically references .jar files, the root cause for any non-exe executable type is the same.

@blaubaer
Copy link
Author

Ok, I put the content also into #3386.

@denelon denelon added this to the 1.8 Client milestone May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate Issue is a duplicate
Projects
None yet
Development

No branches or pull requests

3 participants