-
Notifications
You must be signed in to change notification settings - Fork 19
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
-T LZVN doesn't work #29
Comments
afsctool -T LZVN -c /path/to/random/file
Two things seem to be going on here:
/path/to/random/file: unsupported compression type 2 bytes
This message indicates that LZVN support has in fact not been enabled.
Unable to compress file (already compressed).
And this suggests that your file was already compressed. But it can be an artefact because of LZVN support not having been enabled.
What does `/usr/bin/ls -lO /path/to/random/file` print?
I think LZVN support is enabled (cmake LZVN repo then cmake afsctool), but it doesn't seem to work on High Sierra.
Did you install LZVN? Just building it isn't enough, the headers and library must be available in a location where cmake can find them. Cmake should report whether LZVN support is being enabled.
I've made a few small changes to afsctool so that it gives clearer error messages when LZVN support has not been enabled. Please pull afsctool, rebuild and try to compress your random file again. Then, install LZVN and re-cmake and re-build afsctool .
|
make install LZVN
cmake -Wno-dev .. afsctool (after last git pull)
Later edit: seems to work when I do
|
Can you make LZVN the default compression format if support is enabled?
I also get |
I could but I won’t.
|
LZVN works for me on High Sierra, so you'll need to check that you are compiling afsctool correctly. I use:
I'm using afsctool 1.6.9. (1.6.8.6-125-ge269dbf) as I've not built a new version in a while. |
I didn't notice this part. I'd need to have one of those files to do some testing, but if lzvn fails itself there probably isn't much I can do about that. I don't really get why you'd want to recompress files with LZVN though. In every test I did it compresses less well than (higher levels of) ZLIB. It may decompress faster, but do you really notice that IRL? OS X has a rather agressive file cache, and to the best of my knowledge this comes after the file system (i.e. it caches data after "HFS decompression"). |
FWIW I use LZVN because macOS App Store uses LZVN, and I mainly compress apps so I want to keep things the same as those apps. |
Whatever floats your boat :)
I tend to recompress apps to make them smaller, not to do things the way Apple do them. Apple also makes money from selling disk space so they have a vested interest in not minimising the space occupied by the software they sell ;)
|
I read that here the other day, and I countered by saying that Apple ship their OS and apps from the Mac App Store with HFS+ compression turned on, so I don't really see the reasoning? My reason is not to "do it like Apple" but so that my scripts and workflow do not undo what Apple have done and then redo with the same. Also, LZVN is more efficient in terms of speed and CPU usage, so I don't notice when it's working in the background (compared to ZLIB that makes my fans go crazy). But, yes, whatever works for each of us. Also, try FSNotes for an app that gives this:
|
I can confirm this on multiple apps. LZVN utility produces 0 bytes output on the same files. |
Apple ship their OS and apps from the Mac App Store with HFS+ compression turned on
But not with the most efficient kind of compression.
lzvn compression failed on chunk #0
I can reproduce that. It's not overly surprising given that the input file is only 2 bytes large...
It looks like there is an undocumented 8 byte lower limit to LZVN compression, under which it simply fails.
I pushed updates to lzvn and afsctool in order to ignore files < 8 bytes (and to improve verbose output a bit, the error I mentioned elsewhere that I wanted to fix).
|
Thanks René! |
|
Now we just need ARM-support for LZVN :-) |
Now we just need ARM-support for LZVN :-)
In the library I presume, or is there (also) an endianness issue in my own code?
|
In the library yeah – there's lots of assembly code in there. |
I'm going to compare that implementation with the generic-C implementation in liblzfse. Turns out there's one in there... If performance is close enough to the one from the assembly code I'm just going to use a single dependency.
|
@malthe - Can you check the lzfse branch please (be sure to initialise the submodule!)? A priori it should provide LZVN and LZFSE support on both Apple's architectures now.
|
@RJVB works perfectly. |
@RJVB works perfectly.
That was fast! :)
Both LZVN and LZFSE compression?
|
It takes quite a while, but this is an 8GB run:
(Both LZVN and LZFSE tested.) |
You could have tested with a single file ;)
For reference, LZVN compression of a 128Mb file takes about 3.5s on my 2nd gen. i7 using the lzfse library. That's maybe 10% slower than with the assembly implementation. That surprises me a little bit, the C implementation almost looks like assembly, with lots of cases and gotos so it wouldn't surprise me if the assembly implementation actually came from an older version of that same code. We'll see if I get flamed for a performance regression from users on Intel hardware!
|
@malthe off-topic, slightly, but regarding your (old) blog post: https://maltheborch.com/#using-built-in-transparent-compression-on-macos |
@gingerbeardman thanks – I was planning to update that post once this is all merged in. Will try and see if I can come up with a command-line for ditto. |
@malthe from |
@gingerbeardman doesn't work if
|
ah yes, you have to do a dance through a temporary file |
FWIW, it's always been a pet theory of mine that Apple don't provide a tool for in-place compression (and even less so, transparent automatic FS-level compression) because they also sell storage space.
You may remember that it was long possible (and somewhat common usage) to clean off all the useless translation data (which often comes with copies of image resources) and indeed even the OS X installer allowed you to select to install only the languages you had use for (which would then be "completed" during subsequent updates which didn't have that option). App bundle signing has made that impossible.
|
I've heard that before, but my counter is that they apply this to the system and Mac App Store so they're doing more than nothing. I do think they should enable it by default but there are so many issues that would raise. Apple storage is pretty reasonable price these days. |
My counter would be that they needed compression to bring down the OS and size of most apps to something reasonable enough to be able to sell their entry-level computers with fixed storage back when those barely had enough space. Once you start deploying compression it probably becomes cheaper just to apply it unconditionally to everything.
Apple storage is pretty reasonable price these days.
Yeah right, as in just buy a new computer because you can't increase your internal storage? ;)
I presume "CleanMyMac" only removes language resources that are not inside app bundles, and possibly from apps that aren't signed (or are known not to be crippled when they lose their signing)?
|
I'd say: you presume too much :) Well, I just installed OmniGraffle from the Mac App Store and it stripped the localisation out of that with no effect on the running of the app. |
Good to know but I wonder how they pull it off. Maybe Apple changed something in the way apps are signed, taking into account the fact that removing a translation resource cannot possibly be the cause of a security issue?
|
BTW, According to libfsapfs (scroll past the table):
Similar to how an I think this could be used to handle cases where the last block is too small for LZVN (or if LZVN compression would ever increase the size of the block) |
I think this could be used to handle cases where the last block is too small for LZVN
If memory serves me well that case is already handled (and not by rejecting the entire file).
(or if LZVN compression would ever increase the size of the block)
Both options would need to be tested to see if the kernel supports them!
|
It looks like it's currently handled by rejecting the whole file: Lines 239 to 246 in cadc2a3
|
It looks like it's currently handled by rejecting the whole file:
Right, I remember now being p*d to have to reject a file for a single chunk. Would you like to have a go at implementing your idea?
|
I have a hunch though that the original author might have thought of (and tested) the ZLIB equivalent for increasing chunks - instead he implemented an option to allow compressing them.
|
I think LZVN support is enabled (cmake LZVN repo then cmake afsctool), but it doesn't seem to work on High Sierra.
The text was updated successfully, but these errors were encountered: