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

Fix scanimage -A parsing with [advanced] #565

Merged
merged 1 commit into from
Feb 18, 2023
Merged

Fix scanimage -A parsing with [advanced] #565

merged 1 commit into from
Feb 18, 2023

Conversation

sbs20
Copy link
Owner

@sbs20 sbs20 commented Feb 18, 2023

Issue #564

There are cases where scanimage -A outputs an additional square bracketed item on a parameter line such as:

    --contrast -127..127 [0] [advanced]

The old regex only assumed this happened once - which was good enough for 6 years or so. It seems that it can happen twice.

The regex has been updated to have a non-greedy match for the first one (default) and there is a subsequent optional group for the second, which for want of a better name is referred here as meta.

It turns out that this pattern has been seen before with [read-only] but that was benign since it was treated as a default to ignore. For that reason, the enabled flag has to be altered too.

Associated unit test added.

Issue #564

There are cases where `scanimage -A` outputs an additional square bracketed item on a parameter line such as:

```
    --contrast -127..127 [0] [advanced]
```

The old regex only assumed this happened once - which was good enough for 6 years or so. It seems that it can happen twice.

The regex has been updated to have a non-greedy match for the first one (`default`) and there is a subsequent optional non-capturing group for the second, which for want of a better name is referred here as `meta`.

It turns out that this pattern has been seen before with `[read-only]` but that was benign since it was treated as a default to ignore. For that reason, the `enabled` flag has to be altered too.

Associated unit test added.
@sbs20 sbs20 self-assigned this Feb 18, 2023
@sbs20 sbs20 merged commit 436a164 into master Feb 18, 2023
@sbs20 sbs20 deleted the iss564 branch February 18, 2023 23:24
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.

1 participant