[pve-devel] [PATCH v3 kernel-meta] fix #2403: exclude initrd entries from /proc/cmdline

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Nov 8 13:26:25 CET 2019


On 11/8/19 1:20 PM, Oguz Bektas wrote:
> On Thu, Nov 07, 2019 at 08:43:17PM +0100, Thomas Lamprecht wrote:
>> On 10/16/19 1:17 PM, Oguz Bektas wrote:
>>> +		CMDLINE="$(awk '{gsub(/\yinitrd=([0-9a-zA-Z\/\\._-])*\s*/,x)}1' /proc/cmdline)"
>>
>> sooo, this does not works at all with the default installed mawk...
>> Only with gnu awk, which one may get fast installed on a developer
>> workstation... :/ So we all did not test clean environments..
> 
> :/
> 
>>
>> it seems mawk has no word boundary regexp[0], soo either we depend on gawk
>> or we find a way were it works with mawk.. 
>>
>> [0]: https://mail-index.netbsd.org/tech-userlevel/2012/12/02/msg006954.html
> 
> i looked around a bit but couldn't figure out a way to make it work with
> mawk. so maybe it's better to just use perl instead, to avoid having
> gawk dependency?
> 
> perl -ne 's/\binitrd=([0-9a-zA-Z\\\/.-])*\s*//g; print;' /proc/cmdline
> 

sounds good to me. FYI, you could also replace the print and -n switch with
the -p switch:

perl -pe 's/\binitrd=([0-9a-zA-Z\\\/.-])*\s*//g' /proc/cmdline

see: perldoc perlrun




More information about the pve-devel mailing list