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

A few small bugfixes #490

Merged
merged 8 commits into from
Aug 26, 2024
Merged

A few small bugfixes #490

merged 8 commits into from
Aug 26, 2024

Conversation

katef
Copy link
Owner

@katef katef commented Aug 24, 2024

Previously this gave:
```
; ./build/bin/re -r literal -G 3 abc
; ./build/bin/re -r literal -G 4 abc
abc
;
```
and now -G 3 does construct "abc" (not including the newline, which is a property of the printing, not of the constructed string):
```
; ./build/bin/re -r literal -G 3 abc
abc
; ./build/bin/re -r literal -G 4 abc
abc
;
```

and:
```
; ./build/bin/re -r native -G 3 '^x+$'
x
xx
xxx
```

Spotted by @pierreganty (#478), thank you
@katef katef added the bug label Aug 24, 2024
if (ctx->buf_used + ctx->sed[sf->s_id] >= ctx->max_length) {
LOG(2, "PRUNING due to max length: used:%zu + sed[%d]:%u >= max_length:%zu\n",
if (ctx->buf_used + ctx->sed[sf->s_id] > ctx->max_length) {
LOG(2, "PRUNING due to max length: used:%zu + sed[%d]:%u > max_length:%zu\n",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silentbicycle requesting your review for this please, I was unsure about this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think > is correct here -- this means "if the buffer used so far plus what we'd need for the shortest distance to an end state exceeds the available buffer". re -G 5 '^abcde' should produce "abcde" as a valid 5-character match (which is rejected with >=), not counting the trailing \0, but reject re -G 5 '^abcdef'.

This doesn't help for #317, but whatever the solution is there, asserting about it is the wrong thing to do.

Spotted by @classabbyamp, thank you
I have extremely broken the iprange example. I am very unsure what's going on with this program.
if (ctx->buf_used + ctx->sed[sf->s_id] >= ctx->max_length) {
LOG(2, "PRUNING due to max length: used:%zu + sed[%d]:%u >= max_length:%zu\n",
if (ctx->buf_used + ctx->sed[sf->s_id] > ctx->max_length) {
LOG(2, "PRUNING due to max length: used:%zu + sed[%d]:%u > max_length:%zu\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think > is correct here -- this means "if the buffer used so far plus what we'd need for the shortest distance to an end state exceeds the available buffer". re -G 5 '^abcde' should produce "abcde" as a valid 5-character match (which is rejected with >=), not counting the trailing \0, but reject re -G 5 '^abcdef'.

@katef katef merged commit 632ddd3 into main Aug 26, 2024
346 checks passed
@katef katef deleted the kate/bugfixin branch August 26, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants