-
Notifications
You must be signed in to change notification settings - Fork 9
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
Meta Data Handling #7
Comments
Hello again! 😄
Never feel bad to point something out or otherwise suggest an improvement! I agree with what you're saying here, because:
I would be happy to implement this in Cadius and Merlin! Correct me if I am wrong, but in addition to the file header we would also likely need to add a feature to dump files and strip header (e.g. if you want to transfer a source file for editing)? |
:-))
Okay, I see sort of a misunderstanding (?)... From the perspective of Cadius (and alike) it's all the way from "exporting" a ProDOS file from the ProDOS filesystem to a foreign filesystem and back. There people may have very well different ideas on how they want things. If you look e.g. at CiderPress it asks you on exporting (aka extracting) a ProDOS file if you want to "preserve Apple II formats" or "easy access in Windows". I'm afraid there's no one-size-fits-all-approach here. However from the perspective of Merlin32 (and alike) it's way simpler. The binary file it generates doesn't serve any purpose at all in the foreign filesystem. The only reasonable thing to do with it is to "import" it into a ProDOS filesystem. Therefore there's no downside in generating a proprietary header in Merlin32 (or alike) that is stripped in Cadius (or alike). What does that mean from my POV?
To summarize:
I'm personally only maintaining a cross dev tool so for me personally both perspectives are identical. AppleCommander already has two special options for importing files created by cross dev tools. It doesn't have options to preserve meta data on file export. I can't estimate if its author is interested to add support for writing a header on export. Exomizer is targeting cross dev tools and I'm in contact with the author so I'm pretty sure he will both read and write such a header. |
Yes! I think we are saying the same thing 😃. I agree: default behavior should be to create the header unless the user explicitly tells it not to (via some kind of flag or option or similar). The header should be an easy change to make here and in Merlin. I haven't made any edits to Merlin yet so I'll push it to source control sometime this week and start making the changes. I'm also going to open another issue for targetting block device support, since this is something that would be great to have when writing to our CF cards! |
:-)) So we're left with the task to actually define the header. The cc65 toolchain is focusing on 8-bit development and only generates BIN and SYS files. So from that perspective the 1-byte filetype and the 2-byte auxtype would be all that's needed. However, I presume that you have (much) more needs. I guess it's best when we come up with some extendable format, something with name (aka ID) - value pairs. I could imagine 2-byte IDs with e.g.
The 2-byte ID is followed by a 2-byte size. This allows a header parser to easily skip IDs it doesn't understand and/or isn't interested in. After the 2-byte ID and the 2-byte size there's data specific to the ID in a format specific to the ID. For the ID $0001 the format is always a single bytes. So just presuming for a moment the 4-byte file signature would be A1 B2 C3 D4 e.g. a classic BIN file to be loaded at $803 would have the header: A1 B2 C3 D4 01 00 01 00 06 02 00 02 00 03 08 00 00 Regards, |
John pointed out to me that Apple specified the AppleSingle format for similar use cases. It seems a bit heavy weight, especially as the length of the data fork needs to be placed in its entry descriptor. This might be a problem for tools which want to "stream" the data fork into the file without knowing the final length as they need to rewind to set the length. Anyhow, for cc65 that's not a problem so if you strongly prefer AppleSingle over a homebrewn approach I'm personally fine with that. |
The only thing that would make AppleSingle attractive is integration with existing tools (or maybe Apple development tools like old APW / MPW / if there are even any that use it?). I prefer the lighter homebrew solution. |
My vote is to adopt AppleSingle as there are too many incompatible metadata formats already. Example AppleSingle source: -JB |
It does appear that there are a fair amount of tools out there that use AppleSingle. I spent some time searching for software and found everything from disk imaging utilities to font conversion software. Netatalk also supports AppleSingle/AppleDouble. Here's the RFC. While I still have preference on the lighter (and IMO clearer) format, I think that the legacy support argument wins this one. @oliverschmidt, is that cool with you? |
At the time I wrote #7 (comment) I didn't know of AppleSingle. When I learned about AppleSingle I wondered: Is this just some old spec we can re-use instead of re-inventing the wheel or are there actual synergy effects with existing software supporting AppleSingle. Several packages were linked to far in this thread but there was no free package so far that would allow to do something with an AppleSingle file on a non-MacOS machine :-( Beside the - at least according to my current knowledge - missing synergy effect on Linux/Windows that means that it's hard to do interoperability tests without a MacOS machine. But maybe John is willing/able to help here when we send him AppleSingle files to check. Apart from all that I see a issue with AppleSingle when compared to #7 (comment). It contains more than it needs / more than it should for our use case - and those things don't seem to be really optional. Both the PDF I linked and the source file linked say
So what does that mean from my POV? I don't see me generating AppleSingle files with Entry ID's 3 and 8. I see for our use case AppleSingle files with those IDs:
https://tools.ietf.org/html/rfc1740 says Opinions? |
Merlin32 has a special mnemonic (
I suppose we could put the entirety of this burden on the imaging utility. CADIUS can create the name & date fields of the file (e.g. as sourced from the local filesystem) if we feed it raw data (not AppleSingle) while writing it to the ProDOS partition. If there is an existing AppleSingle header we can add a CLI flag to overwrite the filename contained in the header. Does this seem crazy? @oliverschmidt @JohnMBrooks, are you guys interested in making a Slack or similar for Apple II development so we can chat about this with a slightly faster feedback loop (and possibly more people interested in this standardization discussion)? |
I'm sort of waiting for feedback from @JohnMBrooks on my #7 (comment) but feel it's inappropriate to not answer...
Hm, I'd say it's at least not very anticipation-compliant. I've given this some more thought in the meanwhile. I'm personally only responsible for cc65, a cross dev tool only generating files with meta data, but not consuming them. I see for cc65 only two viable options:
However, you are working both on Cadius and Merlin32 and thus see both sides of the table. Apart from that I understand that Merlin32 creates Resource Forks (and potentially other meta data) which cc65 doesn't so you may have a different perspective. I'd primarily like to see cc65 files to be consumable by Cadius. So if you have a strong preference for my 1.) or 2.) then I'll follow that. If you are open for both alternatives then I'd rather opt for 2.) for two reasons:
I'm willing to join but I'm not keen.
More opinions doesn't necessarily yield better results ;-) |
My preference would be using as lightweight an AppleSingle as possible, and then add fields only if/when they are useful. As Oliver recommended: 1: Data Fork (obligatory) I agree that embedding a ProDOS name (3) or file dates (8) doesn't really help us since the local filesystem metadata will be as-good or better than what we would put into the AppleSingle file anyway, so better to avoid the extra size and complexity. I agree AppleSingle is heavyweight for what will often amount to 3 metadata bytes (filetype byte & auxtype short). But it also allows resource forks, icons, and finder info if needed. AppleSingle also has the chance to be compatible with other tools, which makes it a net win IMO.
If this turns out to be a problem, there could be an option to add name & date metadata simply to improve compatibility.
Yes, or we could require that AppleSingle files with ProDOS metadata must use ProDOS-valid file names, and then report any invalid names as an error so the user can 'fix' naming problems rather than auto-mangling the file name (or an option to auto-mangle vs warn vs error). It would also be very handy if Cadius had an option to convert Ciderpress metadata format to AppleSingle and vice versa. This would allow quick 'native' access to simple ProDOS txt & bin files without having to use a separate AppleSingle extract/pack utility.
Sure. I haven't used Slack, but happy to try it. I primarily use Skype, Google Hangouts & Twitter for dev-team discussions. -JB |
Is their metadata format documented somewhere? I searched but didn't find much, wanted to ask before RE-ing it. I agree with this and we can do it 👍 |
It's just the #FFAAAA name suffix that you've already added to Cadius. 🥇 See "Extracting Files":
-JB |
@mach-kernel: What is the current status from your POV? Do we have an agreement on AppleSingle with Entry IDs 11 and 1? Or do you want/need to include more people into your decision making process? Or do you just need some more time to think about it? Or <...>? |
Yes, it looks like we have agreement! 👍 Let's use AppleSingle and IDs 11,1. I'll also try to add support to CADIUS for 3,8 in certain situations like described above. |
Great :-) I've attached my first AppleSingle file. It's a BIN file to be loaded at $803. As the name suggests it prints "Hello, World". Please check it out and tell me if it meets your expectations / your understanding of our agreement. For easier understanding / communication here's the assembler source I created the header from. The input the file needs is
The header is $3A bytes long. For your convenience here are those $3A bytes from the AppleSingle file attached.
|
In the meantime...
Any progress on the Cadius / Merlin32 side of things? |
Not yet, have been very busy with work. I'll try to sit down this weekend and it done (or at the very least start). |
Thanks for the quick intermediate feedback :-) Sorry if I appear to be pushy. I was just curious if we're still on the same page... |
@oliverschmidt I started, will open a PR soon. Should be done by this weekend. We're all good! 😸 |
@oliverschmidt, give #13 a test run when you have some time! I did some basic tests and everything seems OK, but would appreciate an extra set of eyes. 😸 |
For sure I'm willing to test it with cc65 output! However, it would be nice if you would provide me with a Windows binary to do so. |
@oliverschmidt here you go! |
Thanks :-) I did three tests:
So everything worked just fine out of the box! However, I have one wish: When doing an EXTRACTFILE -A no _FileInformation.txt should be created. |
@oliverschmidt consider it done! I'm going to package everything up to get it ready for release. |
Thanks for making this happen :-) |
Hi,
I've pointing out the below several times in the past so in case it bothers you please just close this issue but I thought I'd give it another try here...
There are from my POV several options on how to transport meta data from a cross dev tool that produces Apple II files in some foreign filesystem (like Merlin32) to a tool that incorporates the files into a ProDOS / GS/OS filesystem (like Cadius):
Sidecar file (like _FileInformation.txt):
The lifecycle of the file doesn't match the lifecycle of the main file. It gets forgotten when copying/moving the main file. It doesn't get deleted when the main file is deleted.
Filename extension:
The name of the file changes when e.g. the load address of a plain BIN file is changed in its source code.
2.1 Either the extended filename is part of the Makefile, then the Makefile needs to be adjusted. Given that the Cadius-like tool is most likely called from within Makefiles this means that there is no real gain over command line arguments for providing the meta data in the first place.
2.2 Or the extended filename is not part of the Makefile but replaced with some $(wildcard) "hack". Then it gets pretty ugly when the Makefile is supposed to know the time stamp of that file to construct the right order of re-build commands.
Proprietary foreign filesystem features:
MacOS HFS+, Windows Alternate Datastreams, Linux XATTR etc. for sure allow to transport the meta data from the dev tool to the Cadius-like tool - if and only if they both run on the same filesystem. But as soon as it comes to sending a file to someone else, moving it to another filesystem, uploading it to some cloud space, putting it into an archive, <...> the meta data is lost.
Proprietary file header:
The dev tools and the Cadius-like tools should agree on a common format to allow for interoperability.
From my POV the last option is in fact the only really viable option!
The http://cc65.github.io/cc65/ toolchain uses a 4-byte DOS3.3 header. That header is supported by https://applecommander.github.io/ and https://bitbucket.org/magli143/exomizer/wiki/Home.
You have direct control/influence on Merlin32 and Cadius.
So I'd say if we agree on some proprietary file header and ...
You implement it both in Merlin32 and Cadius
I implement it in cc65
I talk to the AppleCommander and Exomizer authors to have it implemented
... then we have for sure the momentum to create a standard and have this issue solved once for all!
Just my two cents,
Oliver
The text was updated successfully, but these errors were encountered: