exfatprogs
squashfs-tools-ng
exfatprogs | squashfs-tools-ng | |
---|---|---|
2 | 7 | |
218 | 212 | |
2.3% | 1.4% | |
7.8 | 2.5 | |
14 days ago | 6 months ago | |
C | C | |
GNU General Public License v3.0 only | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
exfatprogs
-
Swapping Sd cards
Other than that the phones/tablets recognize the cards by their "serial" in the filesystem. You can manipulate it with standard tools: https://github.com/exfatprogs/exfatprogs
-
Why is exfatprogs not in the focal repositories?
There is a new exFAT implementation, introduced with kernel 5.7. Ubuntu 20.04 runs on kernel 5.8, so it has the new implementation, but the programs to manipulate exFAT aren't in the repos. These programs are in newer versions of Ubuntu, so I don't see why they wouldn't be in 20.04. The exfat-utils package is for the old FUSE implementation, which is very slow.
squashfs-tools-ng
-
C Strings and my slow descent to madness
... except that that is also subtly broken.
It works if you write multiple UTF-8 code-units in one go, but breaks if you send them in several writes, or if you use the ANSI API (with the A suffix). Guess what the Windows implementation of stdio (printf and friends) does.
I already had some fun with this: https://github.com/AgentD/squashfs-tools-ng/issues/96#issuec...
And we didn't even discuss command line argument passing yet :-)
I tried to test it with the only other two languages I know besides English: German and Mandarin. Specifically also, because the later requires multi-byte characters to work. Getting this to work at all in a Windows terminal on an existing, German Windows 7 installation was an adventure on it's own.
Turns out, trying to write language agnostic command line applications on Windows is a PITA.
-
Getting the maximum of your C compiler, for security
IIRC fanalyzer is a fairly recent addition to gcc. Has it become reasonable usable yet?
I recall getting a bit excited when I first read about it, but the results I got where rather bizarre (e.g. every single function that allocated memory and returned a pointer to it was labeled as leaking memory).
It did the fun exercise myself once to riffle through the gcc manpage, cobble together warning flags and massage them into autoconf[1][2].
There is a very handy m4 script in the util-linux source for testing supported warning flags[3].
[1] https://git.infradead.org/mtd-utils.git/blob/HEAD:/configure...
[2] https://github.com/AgentD/squashfs-tools-ng/blob/master/conf...
[3] https://github.com/karelzak/util-linux/blob/master/m4/compil...
- Squashfs turning 20, Squashfs tools 4.5 released
-
The Byte Order Fiasco
FWIW there is an on various BSDs that contains "beXXtoh", "leXXtoh", "htobeXX", "htoleXX" where XX is a number of bits (16, 32, 64).
That header is also available on Linux, but glibc (and compatible libraries) put named it instead.
See: man 3 endian (https://linux.die.net/man/3/endian)
Of course it gets a bit hairier if the code is also supposed to run on other systems.
MacOS has OSSwapHostToLittleIntXX, OSSwapLittleToHostIntXX, OSSwapHostToBigIntXX and OSSwapBigToHostIntXX in .
I'm not sure if Windows has something similar, or if it even supports running on big endian machines (if you know, please tell).
My solution for achieving some portability currently entails cobbling together a "compat.h" header that defines macros for the MacOS functions and including the right headers. Something like this:
https://github.com/AgentD/squashfs-tools-ng/blob/master/incl...
This is usually my go-to-solution for working with low level on-disk or on-the-wire binary data structures that demand a specific endianness. In C I use "load/store" style functions that memcpy the data from a buffer into a struct instance and do the endian swapping. The copying is also necessary because the struct in the buffer may not have proper alignment.
In C++ code, all of this can of course be neatly stowed away in a special class with overloaded operators that transparently takes care of everything and "decays" into a single integer and exactly the above code after compilation, but is IMO somewhat cleaner to read and adds much needed type safety.
-
Tar is an ill-specified format
I once foolishly thought, I'll write a tar parser because, "how hard can it be" [1].
I simply tried to follow the tar(5) man page[2], and got a reference test set from another website posted previously on HN[3].
Along the way I discovered that NetBSD pax apparently cannot handle the PAX format[3] and my parser inadvertently uncovered that git-archive was doing the checksums wrong, but nobody noticed because other tar parsers were more lax about it[4].
As the article describes (as does the man page), tar is actually a really simple format, but there are just so many variants to choose from.
Turns out, if you strive for maximum compatibility, it's easiest to stick to what GNU tar does. If you think about it, IMO in many ways the GNU project ended up doing "embrace, extend, extinguish" with Unix.
[1] https://github.com/AgentD/squashfs-tools-ng/tree/master/lib/...
[2] https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5
[3] https://mgorny.pl/articles/portability-of-tar-features.html
[4] https://www.spinics.net/lists/git/msg363049.html
-
LZ4, an Extremely Fast Compression Algorithm
A while ago I did some simplistic SquashFS pack/unpack benchmarks[1][2]. I was primarily interested in looking at the behavior of my thread-pool based packer, but as a side effect I got a comparison of compressor speed & ratios over the various available compressors for my Debian test image.
I must say that LZ4 definitely stands out for both compression and uncompression speed, while still being able to cut the data size in half, making it probably quite suitable for life filesystems and network protocols. Particularly interesting was also comparing Zstd and LZ4[3], the former being substantially slower, but at the same time achieving a compression ratio somewhere between zlib and xz, while beating both in time (in my benchmark at least).
[1] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...
[2] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...
[3] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...
What are some alternatives?
webMAN-MOD - Extended services for PS3 console (web server, ftp server, netiso, ntfs, ps3mapi, etc.)
squashfs-tools - tools to create and extract Squashfs filesystems
FATtools - Facilities to access (ex)FAT filesystems and disk images with Python 3
7-Zip-zstd - 7-Zip with support for Brotli, Fast-LZMA2, Lizard, LZ4, LZ5 and Zstandard
goutil - 💪 Helper Utils(700+): int, byte, string, array/slice, map, struct, dump, convert/format, error, web/http, cli/flag, OS/ENV, filesystem, system, test/assert, time and more. Go 常用的一些工具函数:数字,字符串,数组,Map,结构体,反射,文本,文件,错误,时间日期,特殊处理,格式化,常用信息获取等等
dracut - dracut the event driven initramfs infrastructure