insights-core icon indicating copy to clipboard operation
insights-core copied to clipboard

Call sed with -E instead of -r

Open Glutexo opened this issue 6 years ago • 1 comments

Even though Insights is intended to primarily run only on RHEL, I believe that every bit of portability counts. It can help running tests on a machine that‘s not supported by Insights, but runs Python and Pytest just well.

Payload retrieved from a spec is obfuscated for passwords by a sed script. Sed is running with a -r option to use “extended regular expression”. OpenBSD (namely macOS) version of sed uses -E option for that. Fortunately, GNU sed used on most Linuxes including RHEL and Fedora support this variant, treating this -E as an alias for its own -r. It doesn’t work the other way round though. (source)

I want to suggest using -E instead of -r because it is supported on more platforms and it doesn’t affect RHEL/Fedora in any way. This alias is supported from sed version 4.2, though undocumented until 4.3. RHEL6 uses 4.2.

Glutexo avatar Jul 19 '18 06:07 Glutexo