You are not logged in.

#1 2024-12-17 15:02:29

Jowo
Member
Registered: 2023-09-09
Posts: 7

File has wrong file type and application can't open it.

o7

Problem
I take notes with http://www.styluslabs.com/ Write. The program uses .svgz files.
Recently I got the error ' "notes.svgz" could not be opened' seemingly out of nowhere trying to open the file.

Steps to reproduce
I can't really say how, because I can't remember doing something to damage or alter the file.

Expected behaviour
The application opens the file without problem.

Solution approach
I tried to open the file with gimp but that wont work either: "Opening 'notes.svgz' failed: Unknown file type".
After getting this error message I tried to check the file with the "file" command.

file notes.svgz
notes.svgz: data

The expected behaviour should be (with notes_intact.svgz, which is an intact file)

file notes_intact.svgz
notes_intact.svgz: gzip compressed data, extra field, original size modulo 2^32 6500159

Questions
How can the file type change and is it possible to change the file type to the one of "notes_intact.svgz"?
Can I check whether the file is damaged or has been altered such that the file is no longer an svgz file?
Is the file type even responsible for the application to open the file?

Thanks in advance :)

Offline

#2 2024-12-17 16:45:16

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

The file wa corrupted for pretty much sure.
svg itself is plain text but there was likely an issue w/ the compression or the filesystem or your disk is dying.

* btrfs/xfs/f2fs ?
* ssd w/ overaggressive trimming strategy?
* nvme?
* any hard reboots recently?

As for the file at hand, it seems to at least lack the gz header…

od -x notes.svgz | head -n1

Offline

#3 2024-12-17 17:49:56

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

I have an nmve with ext4. I did no manual changes. No hard reboots recently and I think I didn't close Write improperly (or maybe I did but then I wouldn't be aware of it). The problem has to lie somewhere tho...

od -x notes.svgz | head -n1
0000000 0000 0000 0000 0000 0000 0000 4c53 01c0

Offline

#4 2024-12-17 20:06:28

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

So that starts out w/ some null bytes and 4c53 isn't anything either - the gzip signature is 1F 8B, https://en.wikipedia.org/wiki/List_of_file_signatures (the byte order there is reverted, you'd see it as 8b1f)

You could try to add the signature w/ https://archlinux.org/packages/extra/x86_64/hexedit/ (ctrl+x,y will save and exit) by replacing the first "00 00" bytes, but god knows what's in that file right now.

Ceck your journals for nvme related errors, https://wiki.archlinux.org/title/Solid_ … leshooting but it's not really possible to tell what might have corrupted the file (this late after the fact)

Offline

#5 2024-12-19 16:45:30

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

I edited the file with hexedit and changed 00 00 -> 1F 8B

This resulted in

file notes_hex.svgz
physik_521_hex.svgz: gzip compressed data, reserved method, from FAT filesystem (MS-DOS, OS/2, NT), original size modulo 2^32 73648793

This looks promising but Write still won't open the file.

I didn't look into the journal since this is now older than a week probably... My drive seems to be working fine nevertheless. I had no similar issues the past week.

Offline

#6 2024-12-19 18:17:09

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

Changing the signature won't do anything about the contents and you'll likely not be able to "gunzip notes_hex.svgz" either
If you don't worry about exposing the pot. content, you can "cat notes_hex.svgz | curl -F 'file=@-' 0x0.st" to upload it so we can maybe get any idea what might be in there (at all)

Offline

#7 2024-12-19 23:47:01

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

Here's the link http://0x0.st/XCyr.bin . The original contents is just lecture notes so nothing to hide.

Yes gunzip doen't work. It gives me 'unkown method 0 -- not supported'

Offline

#8 2024-12-20 00:23:36

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

This is an incredbly sparse (4/5th are a block of null bytes after a brief "header") 23MB file that looks encrypted or compressed.
The signature 8b1f shows up 34 times (but that doesn't mean all that much in and by itself in 5MB od data)

What kind of dimensions would you typically expect?

Offline

#9 2025-01-04 09:54:32

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

Sorry for the late reply o/

A file size of 23MB sounds right. I have written abt 25 pages. I have another document with 12 written pages of size 9.7MB.

Offline

#10 2025-01-04 10:27:28

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

I have another document with 12 written pages of size 9.7MB.

Is that also full of 0 bytes? (You can try to gzip it, if it's equally sparse it will collapse to 1-2MB max)
Can you post it for comparism?
But if the filetype isn't this sparse in nature you've likely lost major parts of the other file (ie. that's really just random byte garbage)

Offline

#11 2025-01-04 10:44:08

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

When I gzip the 12 pages file (call it notes_12) with size 9.7MB it stays the same size. When I gzip notes.svgz it compresses from 23MB to 5.2MB.

The 8b1f signature exists for notes_12.

Offline

#12 2025-01-04 21:38:18

seth
Member
Registered: 2012-09-03
Posts: 60,807

Re: File has wrong file type and application can't open it.

seth wrote:

the filetype isn't this sparse in nature you've likely lost major parts of the other file (ie. that's really just random byte garbage)

sad

Offline

#13 2025-01-05 13:27:41

Jowo
Member
Registered: 2023-09-09
Posts: 7

Re: File has wrong file type and application can't open it.

Oh well I should make more frequent backups... sad
Thanks for your help smile

Offline

Board footer

Powered by FluxBB