Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263154

[macos] DMG builds have finder errors

XMLWordPrintable

    • b19
    • x86_64
    • os_x
    • Not verified

      ADDITIONAL SYSTEM INFORMATION :
      macOS Catalina 10.15.7

      openjdk version "15.0.2" 2021-01-19
      OpenJDK Runtime Environment (build 15.0.2+7-27)
      OpenJDK 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

      WARNING: Using incubator modules: jdk.incubator.jpackage
      15.0.2

      A DESCRIPTION OF THE PROBLEM :
      An AppleScript is included to put an alias to the Application folder in the DMG which errors. The osascript error ends up an IOException and shows in the build as that. The resulting DMG is missing the Application folder icon and alias. So there is an application icon and a arrow icon indicating 'drag to' but no application folder icon/alias to perform the drag.
      This is a nice jpackage touch, making for a typical Mac application appearing install DMG. It would be good to have it working correctly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See...
      https://bugs.openjdk.java.net/browse/JDK-8226542
      https://bugs.openjdk.java.net/browse/JDK-8250615
      Pretty much seems to happen on all DMG builds right now.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The osascript runs and creates a Application folder alias and the mounted DMG image shows an Application folder icon to drag the user application icon to.
      ACTUAL -
      This error in a verbose jpackage dmg build...

      Running [osascript, /var/folders/dh/91wmrk0n6lzfmr4tjhjmcfp40000gn/T/jdk.incubator.jpackage17385828093712223986/config/SundaySudokuSolver-dmg-setup.scpt]
      /var/folders/dh/91wmrk0n6lzfmr4tjhjmcfp40000gn/T/jdk.incubator.jpackage17385828093712223986/config/SundaySudokuSolver-dmg-setup.scpt:1108:1330: execution error: Finder got an error: Can’t make class alias file. (-2710)
      java.io.IOException: Command [osascript, /var/folders/dh/91wmrk0n6lzfmr4tjhjmcfp40000gn/T/jdk.incubator.jpackage17385828093712223986/config/SundaySudokuSolver-dmg-setup.scpt] exited with 1 code
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Executor.executeExpectSuccess(Executor.java:75)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.IOUtils.exec(IOUtils.java:167)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.IOUtils.exec(IOUtils.java:135)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.MacDmgBundler.buildDMG(MacDmgBundler.java:393)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.MacDmgBundler.bundle(MacDmgBundler.java:91)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.MacDmgBundler.execute(MacDmgBundler.java:535)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.generateBundle(Arguments.java:680)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.internal.Arguments.processArguments(Arguments.java:549)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.execute(Main.java:98)
      at jdk.incubator.jpackage/jdk.incubator.jpackage.main.Main.main(Main.java:52)

      and an icon for the Applications folder is missing in the mounted dmg image.

      From an email I sent to core-libs-dev...

      It seems it could possibly be the path for the Applications folder. Say if you want something nice to get a name without a forward slash.
      Based on DMGSetup.scpt…

      tell application "Finder"
      set DEPLOY_VOLUME_PATH to "/Volumes/TestImage/"
      set DEPLOY_INSTALL_LOCATION to "Applications"
      set DEPLOY_INSTALL_NAME to "Applications"
      make new alias file at POSIX file DEPLOY_VOLUME_PATH to POSIX file DEPLOY_INSTALL_LOCATION with properties {name:DEPLOY_INSTALL_LOCATION}
      end tell

      tell application "Finder"
      make new alias file at file "TestImage:" to file ":Applications" with properties {name:"Applications"}
      Result:
      error "Finder got an error: Can’t make class alias file." number -2710 from alias file to class

      You get the same error. Note INSTALL_LOCATION is used for both destination and name.

      If you make that a correct path with forward slash but have a separate name variable without forward slash for the name.

      tell application "Finder"
      make new alias file at file "TestImage:" to file "Macintosh HD:Applications:" with properties {name:"Applications"}
      end tell
      Result:
      alias file "Applications" of disk "TestImage" of application “Finder”

      It works. I’m not sure unless something changed why that would suddenly be broke but it does seem to be for DMG’s.

      <end of email>

      CUSTOMER SUBMITTED WORKAROUND :
      From an email I sent to core-libs-dev...

      It seems it could possibly be the path for the Applications folder. Say if you want something nice to get a name without a forward slash.
      Based on DMGSetup.scpt…

      tell application "Finder"
      set DEPLOY_VOLUME_PATH to "/Volumes/TestImage/"
      set DEPLOY_INSTALL_LOCATION to "Applications"
      set DEPLOY_INSTALL_NAME to "Applications"
      make new alias file at POSIX file DEPLOY_VOLUME_PATH to POSIX file DEPLOY_INSTALL_LOCATION with properties {name:DEPLOY_INSTALL_LOCATION}
      end tell

      tell application "Finder"
      make new alias file at file "TestImage:" to file ":Applications" with properties {name:"Applications"}
      Result:
      error "Finder got an error: Can’t make class alias file." number -2710 from alias file to class

      You get the same error. Note INSTALL_LOCATION is used for both destination and name.

      If you make that a correct path with forward slash but have a separate name variable without forward slash for the name.

      tell application "Finder"
      make new alias file at file "TestImage:" to file "Macintosh HD:Applications:" with properties {name:"Applications"}
      end tell
      Result:
      alias file "Applications" of disk "TestImage" of application “Finder”

      It works. I’m not sure unless something changed why that would suddenly be broke but it does seem to be for DMG’s.

      <end of email>

      So basically you would need to pass the osascript (AppleScript) both a Applications folder path and a separate name parameter that being "Application" and change the one line in the script to something like...
      make new alias file at POSIX file DEPLOY_VOLUME_PATH to POSIX file DEPLOY_INSTALL_LOCATION with properties {name:DEPLOY_INSTALL_NAME}
      with the new additional parameter of DEPLOY_INSTALL_NAME = "Applications" it should work as expected.
      I'm not sure how this might be done as a workaround though.

      FREQUENCY : always


            almatvee Alexander Matveev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: