HyperCardPreview icon indicating copy to clipboard operation
HyperCardPreview copied to clipboard

Cannot open stacks from old versions of Mac OS.

Open solarmist opened this issue 3 years ago • 8 comments

For example it's refused to try and open Balls! stack from balls.sit at: https://hypercard.org/Pantechnicon/Apps/Games

Screen Shot 2022-02-14 at 2 03 19 PM

I looked at it briefly, but didn't see anything obvious.

solarmist avatar Feb 14 '22 22:02 solarmist

I just tested HyperCardPreview 1.4 and was able to open the Balls! stack under macOS 10.13.6 (High Sierra).

This must have something to do with the newer version of macOS you’re running or perhaps the way that you decompressed the StuffIt archive.

Can you provide a few more details?

splorp avatar Feb 14 '22 23:02 splorp

Hmm, interesting. I'm on Mac OS Monterey, so I wonder if support for these old files is being dropped bit by bit.

On Feb 14, 2022, at 3:10 PM, Grant Hutchinson @.***> wrote:

 I just tested HyperCardPreview 1.4 and was able to open the Balls! stack under macOS 10.13.6 (High Sierra).

This must have something to do with the newer version of macOS you’re running or perhaps the way that you decompressed the StuffIt archive.

Can you provide a few more details?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.

solarmist avatar Feb 15 '22 02:02 solarmist

As far as decompressing the file I just used the Unarchiver to extract it.

But I do notice that in Monterey things like GetFileInfo are now deprecated. And in hdiutil there's the following notes:

     macOS 10.15:

           •   Introduced lzma compression in the ULMO format, providing smaller images compared to ULFO. These images are not supported in-
               kernel, and will not work on any earlier versions of the OS.

           •   Deprecated OS 9-style dual-fork file support (hdiutil flatten/unflatten).

           •   Removed the deprecated "hdiutil internet-enable" command and the IDME attach flags.

     macOS 11.0:

           •   Removed support for DiskCopy42, DART and NDIF formats.

           •   Removed support for AppleSingle and MacBinary encodings.

           •   Removed the deprecated OS 9-style dual-fork file support (hdiutil flatten/unflatten).

           •   Default file system for new images has changed to APFS (instead of an empty disk image with no partition map). To create an
               empty disk image add "-layout NONE" to the creation flags. This change does not apply to images created with -srcfolder or
               -srcdevice arguments.

     macOS 12.0:

           •   Deprecated UDBZ format (bzip2 compression)

           •   Deprecated segmented UDIF images (hdiutil segment, -segmentSize argument in hdiutil create & convert)

           •   Deprecated hdiutil udifrez/udifderez (embed and extract resources)

solarmist avatar Feb 15 '22 18:02 solarmist

I'm on Mac OS Monterey too, and it works for me. I tried to open your stack and it was fine. Sorry I don't understand what's happening. And I don't use GetFileInfo, I open the resource fork using getxattr.

Capture d’écran 2022-02-15 à 20 45 52

PierreLorenzi avatar Feb 15 '22 19:02 PierreLorenzi

Interesting. Ok, well that's good to know that it's something with my setup. I'll update this if I figure anything out.

solarmist avatar Feb 15 '22 20:02 solarmist

To check if you still have the resource fork, you can execute the command xattr Balls! on a terminal, there must be a line com.apple.ResourceFork.

PierreLorenzi avatar Feb 15 '22 20:02 PierreLorenzi

It's there.

$: xattr Balls\!
    com.apple.FinderInfo
    com.apple.ResourceFork
    com.apple.quarantine

solarmist avatar Feb 15 '22 21:02 solarmist

Well your file seems good, I don't understand what's happening

PierreLorenzi avatar Feb 15 '22 22:02 PierreLorenzi

I'm also unable to open stacks that I know are good (just copied out of an emulator) in Monterey.

  • the file sizes of the stacks are as they should be
  • xattr does not show resource fork (maybe because of above deprecation)
  • using fuse to mount and old disk image containing the files exhibits the same issues

Time to dig out an older macOS machine!

gingerbeardman avatar Oct 31 '22 22:10 gingerbeardman

Indeed, everything is working as expected on an old laptop running Mojave (10.14.6).

Exporting is very, very slow but it'll get there I'm sure.

503 cards in the animation I'm looking at.

gingerbeardman avatar Oct 31 '22 23:10 gingerbeardman

I used Stuffit Destinations.app to unstuff balls.sit to an HFS+ volume in macOS Monterey 12.6.1. The resource fork is intact and can be accessed. The file size should be ≈376K (107K for data fork and 270K for resource fork). The resource fork contains a custom icon which the Finder displays correctly (since the FinderInfo has the "Use custom icon bit" set).

joevt@Joes-Mac-Pro ~ % uname -a
Darwin Joes-Mac-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64 x86_64

joevt@Joes-Mac-Pro ~ % GetFileInfo /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! 
file: "/Volumes/Storage/Downloads/Balls! Folder/Balls!"
type: "STAK"
creator: "WILD"
attributes: avbstClinmedz
created: 01/25/1996 02:43:03
modified: 08/19/1999 13:29:38

joevt@Joes-Mac-Pro ~ % ls -l@ /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! 
-rwxr-xr-x@ 1 joevt  staff  107488 19 Aug  1999 /Volumes/Storage/Downloads/Balls! Folder/Balls!
	com.apple.FinderInfo	    32 
	com.apple.ResourceFork	270390 
	com.apple.metadata:kMDItemWhereFroms	   153 
	com.apple.quarantine	    57 

joevt@Joes-Mac-Pro ~ % xattr -l /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! 
com.apple.FinderInfo: STAKWILD
com.apple.ResourceFork: 
com.apple.metadata:kMDItemWhereFroms: bplist00?_7https://hypercard.org/Pantechnicon/Apps/Games/balls.sit_.https://hypercard.org/Pantechnicon/Apps/Games/
                                                                                                                                                       E
com.apple.quarantine: 0083;638c7c3e;Safari;3A82B947-3333-4E4B-9FDE-D52E892EA83D

joevt@Joes-Mac-Pro ~ % xattr -lx /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! 
# output omitted - lots of hex for the resource fork

joevt@Joes-Mac-Pro ~ % derez -p -only xxxx /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! 2>&1 | sed -E '/.*Skipping /s///'
derez V3.7  
Copyright Apple Computer, Inc. 1986-2018

'ICON' (26635, "Sml Help", purgeable).
'ICON' (19992, "Preferences", purgeable).
'ICON' (27056, "Button Ideas", purgeable).
'XCMD' (9207, "AddColor", purgeable).
'xcmd' (9207, "AddColor", purgeable).
'BITs' (1000, "MyCopyBits", purgeable).
'bits' (1000, "MyCopyBits", purgeable).
'STR#' (8000, "selector names", purgeable).
'STR#' (8001, "Misc errors", purgeable).
'STR#' (8002, "color types", purgeable).
'STR#' (8003, "button types", purgeable).
'STR#' (8004, "field types", purgeable).
'STR#' (8005, "transition names", purgeable).
'STR#' (8006, "Misc strings", purgeable).
'STR#' (9000, "Syntax Strings", purgeable).
'STR#' (9001, "Copyright Strings", purgeable).
'CHEK' (1000, "Time Stamp").
'HCcd' (4076, "4076").
'HCcd' (4366, "4366").
'HCcd' (2817, "2817").
'HCcd' (5471, "5471").
'snd ' (2000, "coin", purgeable).
'snd ' (2001, "Woowoo", purgeable).
'snd ' (2002, "kill", purgeable).
'snd ' (2004, "DOH", purgeable).
'snd ' (2005, "applause", purgeable).
'CURS' (1990, "error1").
'PICT' (29369, "5 Ball.PICT").
'PICT' (27529, "6 Ball.PICT").
'PICT' (12959, "Chartframe").
'PICT' (32690, "PICKS").
'PICT' (12350, "PICK 5").
'PICT' (909, "Bottom Button Bar").
'icl4' (-16455, "Item Icon ").
'icl8' (-16455, "Item Icon ").
'ICN#' (-16455, "Item Icon ").
'icns' (-16455, "Item Icon ").
'HCbg' (3672, "3672").
'HCbg' (2631, "2631").

joevt avatar Dec 04 '22 11:12 joevt

The Balls! icon is visible in the Open File dialog, so the resource fork must be valid.

Check the Finder Info. If it doesn't have the "STAK" type, then HyperCardPreview.app won't know it's a valid file that it can open.

Do you have any anti virus software installed?

joevt avatar Dec 04 '22 11:12 joevt

Curious @joevt! I can reproduce the results of your tests exactly.

  • STAK is there.
  • STAKWILD is there
  • file size is correct

But HyperCardPreview still does not see the file to open it. See below for files as shown in the File Open picker/selector.

I do not run any anti-virus software.

image

gingerbeardman avatar Dec 04 '22 19:12 gingerbeardman

Instead of using "Open Stack...", you can try opening the stack from the Finder?

Maybe verify the contents of the stack but this is unlikely to be wrong.

joevt@Joes-Mac-Pro ~ % xattr -px com.apple.ResourceFork /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\! | xxd -p -r | md5
deb89eb587dc5a85198e343b4a28cb33

joevt@Joes-Mac-Pro ~ % md5 /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\!
MD5 (/Volumes/Storage/Downloads/Balls! Folder/Balls!) = 4d1d9c2bca13e18329ab061a0a88c9af

I don't know how to read swift code. Where's the part that does the "Open Stack..." menu command? Maybe it's all handled by macOS using the document type in the info.plist?

Double check the permissions and owner of the file?

joevt@Joes-Mac-Pro HyperCardPreview % ls -l@ /Volumes/Storage/Downloads/Balls\!\ Folder/Balls\!                                         
-rwxr-xr-x@ 1 joevt  staff  107488 19 Aug  1999 /Volumes/Storage/Downloads/Balls! Folder/Balls!
	com.apple.FinderInfo	    32 
	com.apple.ResourceFork	270390 
	com.apple.lastuseddate#PS	    16 
	com.apple.metadata:kMDItemWhereFroms	   153 
	com.apple.quarantine	    57 

Maybe remove the com.apple.quarantine attribute? Though it doesn't seem to be causing me problems...

Maybe move the Balls! Folder to a different disk? It works for me from ~/Documents for example.

joevt avatar Dec 05 '22 06:12 joevt

Instead of using "Open Stack...", you can try opening the stack from the Finder?

No difference, same error. Double-clicking a HyperCard stack in Finder opens the app (so that association is there) but the app fails to open the file with the same error as earlier.

❯ xattr -px com.apple.ResourceFork /Users/matt/Documents/Share/Balls\!\ Folder/Balls\! | xxd -p -r | md5
deb89eb587dc5a85198e343b4a28cb33

❯ md5 Balls\!
MD5 (Balls!) = 4d1d9c2bca13e18329ab061a0a88c9af

Removing com.apple.macl and com.apple.quarantine attributes makes no difference, same error.

❯  ls -l@ /Users/matt/Documents/Share/Balls\!\ Folder/Balls\!
-rwxr-xr-x@ 1 matt  staff  107488 Aug 19  1999 /Users/matt/Documents/Share/Balls! Folder/Balls!
	com.apple.FinderInfo	    32 
	com.apple.ResourceFork	270390 
	com.apple.lastuseddate#PS	    16 
	com.apple.metadata:kMDItemWhereFroms	   153 

Maybe move the Balls! Folder to a different disk? It works for me from ~/Documents for example.

No difference, same error.

I don't know how to read swift code. Where's the part that does the "Open Stack..." menu command? Maybe it's all handled by macOS using the document type in the info.plist?

https://github.com/PierreLorenzi/HyperCardPreview/blob/059c37f49c71ed92659a8f21e36ce5d2bb604937/HyperCardPreview/Base.lproj/MainMenu.xib#L71

also see:

https://github.com/PierreLorenzi/HyperCardPreview/blob/059c37f49c71ed92659a8f21e36ce5d2bb604937/HyperCardCommon/HyperCardCommon/Command.swift#L152-L159

Hmm

Could there be something different about our installation/setup of APFS?

gingerbeardman avatar Dec 06 '22 10:12 gingerbeardman

same error

I don't think you mentioned an error before. Is there an error message?

Could there be something different about our installation/setup of APFS?

I also have HFS+ partitions. You could try creating a writable HFS+ disk image using Disk Uility.app.

What about disabling sip?

joevt@Joes-Mac-Pro Downloads % csrutil status
System Integrity Protection status: unknown (Custom Configuration).

Configuration:
	Apple Internal: disabled
	Kext Signing: disabled
	Filesystem Protections: disabled
	Debugging Restrictions: disabled
	DTrace Restrictions: disabled
	NVRAM Protections: disabled
	BaseSystem Verification: disabled

I also tried the app in Ventura 13.0.1 without problems (though the issue says old versions of Mac OS)

joevt avatar Dec 06 '22 16:12 joevt

The document “Balls!” could not be opened. HyperCardPreview cannot open files of this type.

Screen shot 2022-12-06 at 16 47 31

I also have HFS+ partitions. You could try creating a writable HFS+ disk image using Disk Uility.app.

I can't open them of HFS volumes either.

I also tried the app in Ventura 13.0.1 without problems (though the issue says old versions of Mac OS)

it means "Cannot open stacks from old versions of Mac OS (on modern macOS using HyperCardPreview)"

SIP will have to wait.

❯ csrutil status
System Integrity Protection status: enabled.

gingerbeardman avatar Dec 06 '22 16:12 gingerbeardman

from old

Oh right. I can't read. Its way passed my bedtime.

Rebuild the Desktop database? But this is Mac OS X so nevermind... https://www.techwalla.com/articles/how-to-rebuild-a-desktop-in-mac-os-x

The creator code of the stack is fine - it launches the app when you double click it. But that error message... https://developer.apple.com/forums/thread/128951

There is a LaunchServices database (the lsregister -dump output is ≈100MB = 1.46 million lines): https://stackoverflow.com/questions/62288573/nsdocumentcontroller-opendocument-not-allowing-selection-of-custom-file-type

bundle id:                  HyperCardPreview (0x188fc)
claimed UTIs:               com.apple.hypercard.stack
--------------------------------------------------------------------------------
type id:                    com.apple.hypercard.stack (0x14ce0)
bundle:                     HyperCardPreview (0x188fc)
uti:                        com.apple.hypercard.stack
flags:                      active  rel-icon-path  imported  untrusted (0000000000000009)
iconFiles:                  Contents/Resources/Stack.icns
conforms to:                public.data, public.presentation
tags:                       'STAK'
--------------------------------------------------------------------------------
claim id:                   178672 (0x2b9f0)
rank:                       Default
bundle:                     HyperCardPreview (0x188fc)
flags:                      doc-type  resolves-icloud-conflicts (0000000000000220)
roles:                      Viewer (0000000000000002)
bindings:                   com.apple.hypercard.stack

joevt avatar Dec 06 '22 17:12 joevt

Year later I want to do the same Christmas project as I abandoned last year, and banging my head against the same problem here.

I have time to solve it this year, so I'm back at it.

lsregister -dump command not found on macOS 12

gingerbeardman avatar Dec 09 '23 19:12 gingerbeardman

type id: com.apple.hypercard.stack (0x14ce0) bundle: HyperCardPreview (0x188fc) uti: com.apple.hypercard.stack flags: active rel-icon-path imported untrusted (0000000000000009) iconFiles: Contents/Resources/Stack.icns conforms to: public.data, public.presentation tags: 'STAK'

@joevt

Using: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump

ls.txt.zip

Mine has an interesting difference... "inactive"

type id:                    com.apple.hypercard.stack (0x26d180)
bundle:                     HyperCardPreview (0x106e14)
uti:                        com.apple.hypercard.stack
flags:                      inactive  rel-icon-path  imported  trusted (0000000000000048)
iconFiles:                  Contents/Resources/Stack.icns
conforms to:                public.data, public.presentation
tags:                       'STAK'

gingerbeardman avatar Dec 15 '23 19:12 gingerbeardman

And there we have it! That was the clue we needed to fix this issue.

I saw in my dump of lsregister that Stacksmith was also registered for HyperCard Stacks. I deleted StackSmith and - lo and behold! - HyperCardPreview can now see and open stacks on Monterey. I have no idea why this would happen. They seem to be competing for the com.apple.hypercard.stack uti?

WILD.

@solarmist do you also happen to have Stacksmith on your Mac?

gingerbeardman avatar Dec 15 '23 22:12 gingerbeardman

Multiple apps claiming the same UTI - Isn't that why there's an Open With menu in the Get Info dialog for the document file in the Finder? And then use the Change All button to make all files of that type be opened by the selected app?

joevt avatar Dec 16 '23 05:12 joevt

(I have of course tried changing that setting on a per-file or per-all basis).

But that's unrelated to the issue at hand. It's not about opening a stack in HyperCardPreview, it's about HyperCardPreview even recognising that it can open the type of file however you try.

I'm confident if you have both apps on your computer you will be able to reproduce the problem.

Here's a video:

https://github.com/PierreLorenzi/HyperCardPreview/assets/49612/e081f6b2-daca-400a-a29b-f7716a8691d1

gingerbeardman avatar Dec 16 '23 22:12 gingerbeardman

Completed? What was the resolution/fix/change? @PierreLorenzi

gingerbeardman avatar Mar 11 '24 02:03 gingerbeardman

Oh from your post I thought you fixed it yourself

PierreLorenzi avatar Apr 09 '24 10:04 PierreLorenzi

Not really, just as workaround by deleting a separate app

gingerbeardman avatar Apr 09 '24 15:04 gingerbeardman

Here's some notes about launch services: https://eclecticlight.co/2024/04/10/how-macos-opens-a-file-in-the-correct-app/ It might not be of help but is interesting.

joevt avatar Apr 10 '24 10:04 joevt