Strange behaivour when unpacking my app from a downloaded zip file

Mac OSX specific forum
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Strange behaivour when unpacking my app from a downloaded zip file

Post by Lebostein »

It's strange and I don't know what to do.

I have two identical zip files with an arm64 compiled PB app. The files have the same checksum. One file was the original zip file, the second file was uploaded to my website and then downloaded again. As I said, even after downloading, they have the same checksum.

If I uncompress the files, the app from the original zip can be launched. But the app from the downloaded zip cannot be opened. I see the error message "The app is damaged and can’t be opened. You should move it to the Trash". :?: (macOS 13.6.3)

I have no problem with a x64 app inside the zip.
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

Hmmm… I believe some Mad Italian posted some stuff that may help you...
But don't forget google…

https://www.purebasic.fr/english/viewtopic.php?t=81549
jamirokwai
Enthusiast
Enthusiast
Posts: 772
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by jamirokwai »

I compiled the steps needed for notarization on MacOS some time ago.
If you like to experience some pain :? check here:

https://www.purebasic.fr/english/viewtopic.php?t=80722
Regards,
JamiroKwai
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Lebostein »

xattr -cr MyApp.app
Thats it! Thanks. But why? How I offer such App now? This seems to be impossible without a manual terminal command.
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by infratec »

Build a dmg file.
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Lebostein »

infratec wrote: Wed Jan 17, 2024 8:55 pm Build a dmg file.
That was also my first thought yesterday. But it doesn't seem to solve the problem.
Fred
Administrator
Administrator
Posts: 16687
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Fred »

You need to notarize it as jamirokwai said.
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

Maybe this can help?
Forgive me: I saw a great tool, but didn't bookmark, and have no time now…

https://www.startpage.com/do/dsearch?q= ... ge=english
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

I found this:
https://ohanaware.com/appwrapper/ (14-Day trial, then $49.99, €58.99)

…but I'm almost sure there's also some good free stuff somewhere… grrr...
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

I noticed a weird thing: after dropping your "damaged" app into e.g. Terminal ICON (NOT window: I have it on Dock…) it will be OK to run!

Also, take a look at xattred: https://eclecticlight.co/xattred-sandstrip-xattr-tools/
User avatar
mk-soft
Always Here
Always Here
Posts: 5409
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by mk-soft »

Create DMG (hdiutil)

Code: Select all

;-TOP by mk-soft, v1.01.0, 20.01.2024

; hdiutil create -volname WhatYouWantTheDiskToBeNamed -srcfolder /path/to/the/folder/you/want/to/create -ov -format UDZO name.dmg

; ----

Procedure CreateDMG(srcFolder.s, dmgFile.s, Title.s = "")
  Protected r1, program, destFolder.s, destFile.s, param.s, Output$
  
  If LCase(GetExtensionPart(dmgFile)) <> "dmg"
    dmgFile + ".dmg"
  EndIf
  
  destFolder = GetPathPart(dmgFile)
  destFile = GetFilePart(dmgFile)
  
  
  If Title = ""
    Title = GetFilePart(dmgFile, #PB_FileSystem_NoExtension)
  EndIf
  
  param = "create -volname " + #DQUOTE$ + Title + #DQUOTE$ + " -srcfolder " + #DQUOTE$ + srcFolder + #DQUOTE$
  param + " -ov -format UDZO " + #DQUOTE$ + dmgFile + #DQUOTE$
  
;   r1 = RunProgram("hdiutil", param, destFolder, #PB_Program_Wait)
  r1 = RunProgram("hdiutil", param, destFolder, #PB_Program_Open | #PB_Program_Read)
  Output$ = ""
  If r1
    While ProgramRunning(r1)
      If AvailableProgramOutput(r1)
        Output$ + ReadProgramString(r1) + Chr(13)
      EndIf
    Wend
    Output$ + Chr(13) + Chr(13)
    Output$ + "Exitcode: " + Str(ProgramExitCode(r1))
    CloseProgram(r1) ; Close the connection to the program
    ;MessageRequester("Output", Output$)
    If FileSize(dmgFile) < 0
      r1 = 0
    EndIf
  EndIf
  ProcedureReturn r1
EndProcedure

;- Main

Enumeration CustomEvent #PB_Event_FirstCustomValue
  #MyEvent_CreateDMG_Busy
  #MyEvent_CreateDMG_Done
  #MyEvent_CreateDMG_Error
  
EndEnumeration

Global srcFolder.s, dmgFile.s

Procedure thCreateDMG(*dummy)
  Protected r1
  PostEvent(#MyEvent_CreateDMG_Busy)
  r1 = CreateDMG(srcFolder, dmgFile)
  If r1
    PostEvent(#MyEvent_CreateDMG_Done)
  Else
    PostEvent(#MyEvent_CreateDMG_Error)
  EndIf
EndProcedure

Procedure Main()
  Protected dx, dy
  Protected r1, temp.s
  
  #WinStyle = #PB_Window_SystemMenu ; | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
  
  If OpenWindow(0, #PB_Ignore, #PB_Ignore, 580, 140, "DMG Create", #WinStyle)
    ; MenuBar
    CreateMenu(0, WindowID(0))
    MenuTitle("File")
    
    ; StatusBar
    CreateStatusBar(0, WindowID(0))
    AddStatusBarField(#PB_Ignore)
    
    ; Gadgets
    dx = WindowWidth(0)
    dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
    TextGadget(0, 10, 10, 100, 20, "Source Folder")
    StringGadget(1, 120, 8, 400, 25, "", #PB_String_ReadOnly)
    ButtonGadget(2, 530, 10, 40, 25, "./.")
    
    TextGadget(3, 10, 45, 100, 20, "DMG File Name")
    StringGadget(4, 120, 43, 400, 25, "", #PB_String_ReadOnly)
    ButtonGadget(5, 530, 45, 40, 25, "./.")
    
    ButtonGadget(6, 10, 80, 120, 30, "Create DMG")
    
    ; Main Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case 0
              Break
          EndSelect
          
        Case #PB_Event_Menu
          Select EventMenu()
            
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case 2
              temp = PathRequester("Folder", "")
              If temp
                srcFolder = temp
                SetGadgetText(1, srcFolder)
              EndIf
              
            Case 5
              temp = SaveFileRequester("DMG File", "", "", 0)
              If temp
                dmgFile = temp
                If LCase(GetExtensionPart(dmgFile)) <> "dmg"
                  dmgFile + ".dmg"
                EndIf
                SetGadgetText(4, dmgFile)
              EndIf
              
            Case 6
              If dmgFile <> "" And FileSize(srcFolder) = -2
                If Not IsThread(r1)
                  r1 = CreateThread(@thCreateDMG(), 0)
                  If Not r1
                    MessageRequester("Create DMG", "Error Create Thread!")
                  EndIf
                EndIf
              EndIf
              
          EndSelect
          
        Case #MyEvent_CreateDMG_Busy
          StatusBarText(0, 0, "  Busy ...")
          
        Case #MyEvent_CreateDMG_Done
          StatusBarText(0, 0, "  Done.")
          MessageRequester("Create DMG", "Ready!")
          
        Case #MyEvent_CreateDMG_Error
          StatusBarText(0, 0, "  Error!")
          MessageRequester("Create DMG", "Error!")
      EndSelect
    ForEver
    
  EndIf
  
EndProcedure : Main()
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

Fred wrote: Thu Jan 18, 2024 9:01 am You need to notarize it as jamirokwai said.
Hey Fred, you know I'm your fan etc., but that does NOT help talented PB developers with a low budget to PB stuff on Mac!

PS: Mon cheri dans la tour Eiffel avec l'ordinateur
mrbungle
Enthusiast
Enthusiast
Posts: 118
Joined: Wed Dec 30, 2020 3:18 am

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by mrbungle »

Notarization is an Apple requirement not a PB one.
User avatar
Piero
Enthusiast
Enthusiast
Posts: 343
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by Piero »

mk-soft wrote: Sat Jan 20, 2024 1:14 pm r1 = RunProgram("hdiutil", param, destFolder, #PB_Program_Open | #PB_Program_Read)
EEEW! I just saw a runprogram parameter!

Jokes apart, some of you are probably thinking we are talking nonsense, if they cannot compile for ARM and test…
User avatar
mk-soft
Always Here
Always Here
Posts: 5409
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Strange behaivour when unpacking my app from a downloaded zip file

Post by mk-soft »

I don't have a Mac M1/M2

Have you tried the code ... Without immediately messing with the parameters.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply