Skip to content

Can't open floppy image #84

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

Open
Vort opened this issue Feb 5, 2025 · 7 comments
Open

Can't open floppy image #84

Vort opened this issue Feb 5, 2025 · 7 comments

Comments

@Vort
Copy link

Vort commented Feb 5, 2025

Hello.

I'm using 7zFM to open floppy image files.
It worked good all the time, until today.

When I tried to open following file: floppy.img.zip, it resulted in "Can't open as archive" message:

Image

Please look what went wrong with it.

I tried to open it with other programs and looks like it is fine.

Version: 24.09

@ip7z
Copy link
Owner

ip7z commented Feb 6, 2025

That FAT image contains long-file-name records before record for deleted file in directory.
Maybe some files with long-file-name were deleted by software that doesn't know about long-file-name records.
Is it so?
7-Zip didn't like these unusual records.
I'll fix that code for next version of 7-Zip, and it will open such images, but probably 7-Zip will show additional warning for such cases.
Thanks for report.

@Vort
Copy link
Author

Vort commented Feb 6, 2025

Maybe some files with long-file-name were deleted by software that doesn't know about long-file-name records.
Is it so?

Last thing I did is removed lots of small files and copied large one with Windows XP.
I won't remember most likely what happened with this image before that.

That FAT image contains long-file-name records before record for deleted file in directory.

I don't quite understand what is going on yet, but maybe long file name entries are needed to fully recover deleted file (with its long name)?

I'll fix that code for next version of 7-Zip, and it will open such images

Ok, thanks.

but probably 7-Zip will show additional warning for such cases

The question is whether this situation is normal or not.
I will try to do more tests with Windows XP, maybe I will figure it out.

@Vort
Copy link
Author

Vort commented Feb 6, 2025

I found another variation of this image, which I most likely used with MS-DOS 6.22: dos_floppy.zip.
It opens fine with 7-Zip, but it already has GlideTest_v1.zip and GlideTest_v2.zip entries stuck there.
I probably created files with long names using Windows, then deleted them with DOS and then later made changes to this image with Windows.

@Vort
Copy link
Author

Vort commented Feb 6, 2025

Ok. Here are reproduction steps:

  1. Format new image with Windows XP;
  2. Create FileWithLongName1.txt there;
  3. Delete this file with MS-DOS;
  4. Create FileWithLongName2.txt with Windows XP.

Here is result: newfloppy.zip.

Such scenario looks completely normal to me, no need for warnings.
It just needs to be handled carefully.

@ip7z
Copy link
Owner

ip7z commented Feb 7, 2025

From fat specification about old software(OS) with long-name FS image:

If the file is deleted, then the long name is simply orphaned. If a new file is created, the long name may be incorrectly associated with the new file name.

Windows creates long name records so:

long-name records for old_DOS_name
old_DOS_name record

If you delete/create/rename file on DOS,
you can get such records after operation.

long-name records for old_DOS_name
new_DOS_name record

checksum is just one byte. So there is (1/256) probability of checksum collision between old_DOS_name and new_DOS_name.
If you have that collision, then new system will use
long-name for old_DOS_name instead of new_DOS_name.

That is why warnings after updating in DOS are useful.
If we have no warnings, user can think that image is good. But it's not good, because there is some probability that Windows will show incorrect name for files in such images.

@Vort
Copy link
Author

Vort commented Feb 7, 2025

That is why warnings after updating in DOS are useful.

What can 7-Zip do if user creates FileWithLongName1.txt and then renames FILEWI~1.TXT to FILEMN~1.TXT?
Check if short name before ~ matches long file name? Algorithm for short name generation is undocumented and convoluted, so I'm not sure if it's a good idea.
Other option is just warn that "image contains long file names and there may be collisions", which will only annoy users.

Also I can't understand why these problems matter for cases of deleted files. As far as I can see, 7-Zip just ignores them. Potential problems in ignored data is the least important thing for the user.

But it's not good, because there is some probability that Windows will show incorrect name for files in such images.

Nevertheless, replicating Windows behaviour as close as possible may be the best option in this case.


However, I don't insist on anything, looks like you have better understanding of this situation, so I expect any solution to be good enough.

@ip7z
Copy link
Owner

ip7z commented Feb 7, 2025

You can delete / rename files in DOS for 256 times.
And 255 times form 256 times you will see correct short name in Windows after these operations.
But 1 time from 256 you will see incorrect long name (produced from old name) in Windows.
So if you do it 10 times and check results each time, you can think that everything is OK.
But 7-Zip can show the warning for you 255 times from 256.
So you will know that the problem is possible. And you can do it with differeent way instead of processing LFN images in DOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants