Re: [PATCH v1 2/4] initramfs: Refactor to use hex2bin() instead of custom approach

From: H. Peter Anvin

Date: Tue Jan 27 2026 - 17:09:04 EST


On 2026-01-20 13:17, Andy Shevchenko wrote:
>>
>> I.e. a "0x" isn't specified as valid prefix. I don't feel strongly
>> regarding diverging from existing behaviour,
>
>> but it should still be
>> considered (and documented) as a potentially user-visible regression.
>
> I disagree, this is not specified and should not be used. The CPIO archive in
> the original form doesn't specify leading 0 for octals (at least how I read it,
> please correct me, if I'm wrong).
>
> https://pubs.opengroup.org/onlinepubs/007908799/xcu/pax.html
>

This is the "newc" or "crc" format used by BSD (header magic 070701 and
070702, respectively), those were never standardized by POSIX.

These formats use 8-character hexadecimal (%08x).

As far as a 0x prefix, or upper case -- no, that is technically not according
to spec, but we DO NOT break user space tools that have been working for 20+
years, unless it is either (a) a security problem or (b) is holding back
further development (e.g. because the format is ambiguous. This is Postel's
law in action.

-hpa