e2fsprogs icon indicating copy to clipboard operation
e2fsprogs copied to clipboard

RFC: Add libarchive support for mke2fs

Open russdill opened this issue 2 years ago • 3 comments

This patch isn't quite ready for merging, but just posted to get a take on what people think. It links in libarchive to allow population of a new ext2/3/4 filesystem in the same way as the root-directory option. Unpacking with file attributes and extended file attributes as supported by the source archive should be functional.

russdill avatar Feb 28 '22 16:02 russdill

Maybe you'd like to add the testcases I submitted as a pull request to your repo: https://github.com/russdill/e2fsprogs/pull/1

These testcases are nearly 1:1 those that I wrote for #118 except that they use the -a option whereas my variant overloads the -d option.

josch avatar Jul 22 '22 17:07 josch

Many Linux distributions require that if you link against an external library, it must be linked in as a shared library. But that means that for programs like mke2fs which is required for use by the installer and/or an "essential" package, it drags in that library package as new mandatory dependency. This bloats things like Docker containers, installers that are supposed to fit on USB thumb drives, etc., etc.

One solution to this problem is to make usage of the library optional, and to bring it in using dlopen. For an example of this please see: https://github.com/tytso/e2fsprogs/blob/master/lib/ss/get_readline.c This allows the debugfs program to have readline functionality if it is available --- but if the shared libraries are not available, then debugfs still works.

tytso avatar Jul 23 '22 02:07 tytso

Thank you for your input @tytso! I added a commit to #118 that uses dlopen and I also pushed a commit that does the same for this pull request here: https://github.com/russdill/e2fsprogs/pull/1

josch avatar Jul 23 '22 18:07 josch