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

Bug 1826021: Fix a problem with a greedy regular expression matching more than needed #1913

Conversation

retroflexer
Copy link
Contributor

Closes: 1826021
- What I did
Fixed a problem with a greedy regular expression.
- How to verify it
Run restore on a master which is not the first one in the ETCD_INITIAL_CLUSTER. It should finish successfully.

- Description for the changelog

Current restore shell script results in an error "Error: snapshot restore requires exactly one argument" if the attempted master in not the first member listed in the ETCD_INITIAL_CLUSTER. This is due to a bug in the regular expression.

@openshift-ci-robot
Copy link
Contributor

@retroflexer: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

In response to this:

Fix a problem with a greedy regular expression matching more than needed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@retroflexer
Copy link
Contributor Author

Compare the outputs from test 1, test 2 and test 3 patterns. The pattern used in this script is test 3. Originally the code had a pattern of test 1.

export ETCD_INITIAL_CLUSTER="etcd-0.example.com=https://etcd-0.example.com:2380,etcd-1.example.com=https://etcd-1.example.com:2380,etcd-2.example.com=https://etcd-2.example.com:2380"
  
  for ETCD_DNS_NAME in "etcd-0.example.com"  "etcd-1.example.com"  "etcd-2.example.com" 
  do
    echo "################## Trying with $ETCD_DNS_NAME"
    echo "test 1"
    echo ${ETCD_INITIAL_CLUSTER} | grep -oP "(?<=)[^,,\s]*(?==[^=]*${ETCD_DNS_NAME}\b)"
    echo "test 2"
    echo ${ETCD_INITIAL_CLUSTER} | grep -oP "(?<=,)${ETCD_DNS_NAME}(?==)"
    echo "test 3"
    echo ${ETCD_INITIAL_CLUSTER} | grep -oP "[^,\s]*(?==[^=,]*${ETCD_DNS_NAME}\b)"
  done

	
### Output
################## Trying with etcd-0.example.com
test 1
etcd-0.example.com
test 2
test 3
etcd-0.example.com
################## Trying with etcd-1.example.com
test 1
etcd-0.example.com
etcd-1.example.com
test 2
etcd-1.example.com
test 3
etcd-1.example.com
################## Trying with etcd-2.example.com
test 1
etcd-1.example.com
etcd-2.example.com
test 2
etcd-2.example.com
test 3
etcd-2.example.com

@retroflexer retroflexer changed the title Fix a problem with a greedy regular expression matching more than needed Bug 1826021: Fix a problem with a greedy regular expression matching more than needed Jul 8, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jul 8, 2020
@openshift-ci-robot
Copy link
Contributor

@retroflexer: This pull request references Bugzilla bug 1826021, which is invalid:

  • expected the bug to target the "4.3.z" release, but it targets "4.6.0" instead
  • expected Bugzilla bug 1826021 to depend on a bug targeting a release in 4.4.0, 4.4.z and in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but no dependents were found

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1826021: Fix a problem with a greedy regular expression matching more than needed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hexfusion
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2020
@retroflexer
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@retroflexer: This pull request references Bugzilla bug 1826021, which is invalid:

  • expected Bugzilla bug 1826021 to depend on a bug targeting a release in 4.4.0, 4.4.z and in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but no dependents were found

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@retroflexer
Copy link
Contributor Author

/test e2e-aws-scaleup-rhel7

@openshift-bot
Copy link
Contributor

/bugzilla refresh

Recalculating validity in case the underlying Bugzilla bug has changed.

@openshift-ci-robot
Copy link
Contributor

@openshift-bot: This pull request references Bugzilla bug 1826021, which is invalid:

  • expected the bug to target the "4.3.z" release, but it targets "---" instead
  • expected Bugzilla bug 1826021 to depend on a bug targeting a release in 4.4.0, 4.4.z and in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but no dependents were found

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Recalculating validity in case the underlying Bugzilla bug has changed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@retroflexer
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@retroflexer: This pull request references Bugzilla bug 1826021, which is invalid:

  • expected Bugzilla bug 1826021 to depend on a bug targeting a release in 4.4.0, 4.4.z and in one of the following states: VERIFIED, RELEASE_PENDING, CLOSED (ERRATA), but no dependents were found

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@runcom
Copy link
Member

runcom commented Jul 9, 2020

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hexfusion, retroflexer, runcom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2020
@ashcrow
Copy link
Member

ashcrow commented Jul 9, 2020

Adding valid-bug since the file is not present in 4.4+ so there is no backporting.

@ashcrow ashcrow added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jul 9, 2020
@sdodson sdodson added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Jul 9, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@retroflexer
Copy link
Contributor Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit f6d9ce0 into openshift:release-4.3 Jul 10, 2020
@openshift-ci-robot
Copy link
Contributor

@retroflexer: All pull requests linked via external trackers have merged: . Bugzilla bug 1826021 has been moved to the MODIFIED state.

In response to this:

Bug 1826021: Fix a problem with a greedy regular expression matching more than needed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@retroflexer retroflexer deleted the fix-greedy-pattern-match branch July 10, 2020 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants