genecommerce / module-encryption-key-manager

Tooling to help generate and invalidate magento encryption keys
GNU Lesser General Public License v3.0
70 stars 15 forks source link

zgrep 1.12 is not readily available #63

Open cluck opened 2 weeks ago

cluck commented 2 weeks ago

Ubuntu 20.04.5 LTS still has zgrep version 1.10.

Maybe zgrep -P PATTERN file.gz can be replaced by zcat file.gz | perl -nle 'print if m{PATTERN}'?

More specifically zcat file.gz | perl -nle "print if m{VALUES\s*\(.*\d:\d:...*'}"

convenient commented 2 weeks ago

This sounds good, can you please submit a PR suggesting an update to the README.md ? Maybe leave the zgrep instruction in place but also include this new version?

cluck commented 4 days ago

Actually, what is the reason for requiring zgrep version 1.12?

I tested on Ubuntu 20.04.5 again, and both zgrep and zcat|grep happily match this test case:

echo "INSERT INTO bla VALUES ('a', 2, '3:0:01234567890abcdef');" | gzip > test.sql.gz
zgrep -P "VALUES\s*\(.*\d:\d:...*'" test.sql.gz
zcat test.sql.gz | grep -P "VALUES\s*\(.*\d:\d:...*'"

Moreover, -P is an option that zgrep passes to grep, which comes with it's own version: On Ubuntu 20.04.5:

cluck commented 4 days ago

Pinging @jellesiderius, who introduced the comment in the readme — Thanks, Claudio

cluck commented 4 days ago

Unfortunately I can't validate my two alternatives, as I lack information about the original problem with older zgrep versions.

I think my alternatives are perfect replacements, but then again, my test works with older zgrep too, so I must be missing the entire point.