Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSD grep is stricter about orphan tokens in -E mode #37

Merged

Conversation

dch
Copy link
Contributor

@dch dch commented Nov 23, 2018

Make sure to follow and check these boxes before submitting a PR! Thank you.

If you are using WITH_BSD_GREP=yes in /etc/src.conf then iocell will fail, complaining like this:

# iocell list
egrep: repetition-operator operand invalid
egrep: repetition-operator operand invalid
JID  UUID  BOOT  STATE  TAG  TYPE  IP4  RELEASE
..

Which is due to stricter handling of orphan tokens in BSD grep's ERE compared to old grep.
Basically this */.foo pattern is not compliant, and should be replaced by .*\.foo.

# fail
# zfs list -d3 -rH -o name zroot/iocell | egrep -v 'jails$|releases$|templates$|download|zroot/iocell$|*\./root'
egrep: repetition-operator operand invalid

# success
# zfs list -d3 -rH -o name zroot/iocell | egrep -v 'jails$|releases$|templates$|download|zroot/iocell$|.*\./root'
zroot/iocell/jails/dfa53654-ef6e-11e8-9850-0cc47ae544c8
zroot/iocell/jails/dfa53654-ef6e-11e8-9850-0cc47ae544c8/root
zroot/iocell/releases/11.2-RELEASE
zroot/iocell/releases/11.2-RELEASE/root

I've tested a number of commands against "old grep" iocell and not run into any issues. I believe I got all of the patterns. I checked for both grepstring and egrep ... patterns.

BTW I also kicked the https://iocell.readthedocs.io/en/latest/ build again, it's over a year since it was done. latest branch should be up to date now.

@dch dch force-pushed the fix-allow-bsd-grep branch 2 times, most recently from 025965a to 0e2b27c Compare November 23, 2018 23:28
@dch
Copy link
Contributor Author

dch commented Nov 23, 2018

👎 I've found a few issues with the latest changes, will update the PR when I have tracked them down.

@dch
Copy link
Contributor Author

dch commented Feb 12, 2019

tested these post patch:

  • iocell activate
  • iocell fetch
  • iocell create
  • iocell list FAIL

The first run of iocell list fails to extract the config just before this awk incantation, leading to an invalid empty config, that then creates a new $uuid/config file over-writing the existing settings, including generating a new incorrect uuid, overwriting the tag with value of last_started, losing release, and more.

awk -v 'dq="' '/org.freebsd.iocell/ \
        { $2=dq$2; sub(" "," VALUE ",$0); \
        sub("org.freebsd.iocell:","PROP ",$1); print $0dq }'
...

Back-tracking the code this looks like __dump_config() is called during __migrate_basejail(),l which I'm not sure how this ends up here. Suggestions welcomed, I'm lost as to what's happening here. It doesn't appear to be related to the BSD grep changes though.

@dch
Copy link
Contributor Author

dch commented Feb 15, 2021

I've had this stewing locally for a while; if anybody wants to merge this, please confirm whether the tweaked regex that use /data$|/root$ are sufficient. They are for our needs.

@dch
Copy link
Contributor Author

dch commented Sep 17, 2022

this has been applied downstream a year ago, https://cgit.freebsd.org/ports/commit/sysutils/iocell?id=68fa173526465a755a9b7fdc5ee9b8761c2a47b1 without this iocell is not functional at all on 13.x. Could it get pulled in?

@jurajlutter
Copy link
Contributor

@bartekrutkowski please, merge also this.

@bartekrutkowski bartekrutkowski merged commit e07fa27 into bartekrutkowski:develop Sep 18, 2022
@dch dch deleted the fix-allow-bsd-grep branch September 21, 2022 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants