Comment 1 for bug 2030729

Revision history for this message
Scott Moser (smoser) wrote :

I feel like the right thing to do is either:
a. write a tiny yaml parser in c and use it
b. let 'grep' do much of the filtering.

'a' is a lot of work and pain to get integrated but could ultimately lead to a much higher payout of having ds-identify in c (or rust... some better language than shell).

I feel like 'b' is probably the right solution here even though it requires some re-work and shell forks to get there. dash was chosen by ubuntu as /bin/sh for good reason. dash *does* outperform bash in many/most cases its really unfortunate that this is so bad. (https://www.baeldung.com/linux/dash-vs-bash-performance)

What I suggest is
1. file a bug with dash with an example of how bad the 'read(1)' performs on any non-tiny file.
2. re-work check_config to use 'grep' for most of the filtering.

I've put up a PR at https://github.com/canonical/cloud-init/pull/4327 that shows '2'.