FS#69409 - [mkinitcpio] allow mkinitcpio.conf to set compression level

Attached to Project: Arch Linux
Opened by Allen Wild (aswild) - Friday, 22 January 2021, 23:40 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 23 January 2021, 00:21 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Users can set COMPRESSION_OPTIONS in mkinitcpio.conf, but mkinitcpio appends additional flags to the compression command, and these flags can't be easily overridden.
This is mainly relevant to zstd, where mkinitcpio adds "-19 -T0". Since user flags come before mkinitcpio flags, they cannot change this compression level.

Additional info:
* mkinitcpio version 29-1

Steps to reproduce:
Select COMPRESSION="zstd" and COMPRESSION_OPTIONS=('-6') in mkinitcpio.conf. I would expect the initramfs to be compressed with level 6, but it still compresses with level 19.
The zstd command is run with flags "-6 -19 -T0" and since -19 comes later, it takes precedence. (the same applies to the number of threads, as zstd -T0 uses the number of CPU cores rather than SMT threads)

A simple fix could be to change this line in the build_image() function to prepend the defaults rather than append.
- COMPRESSION_OPTIONS+=('-19' '-T0')
+ COMPRESSION_OPTIONS=('19' '-T0' "${COMPRESSION_OPTIONS[@]}")

The same applies in theory to other compression methods, but currently zstd is the only one where mkinitcpio sets the compression level.
This task depends upon

Closed by  Doug Newgard (Scimmia)
Saturday, 23 January 2021, 00:21 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#69036 
Comment by Alexander Schnaidt (Namarrgon) - Saturday, 23 January 2021, 00:02 GMT

Loading...