-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Can't set autoupdate hash regex to match a line ending #4688
Comments
FYI @rashil2000 I know you've been working in this area recently. |
@rashil2000 I saw those two when I was checking if this issue had already been logged. I think this is a separate issue although based on the docs it should just work. |
I see. Thanks for the report! |
Based on further testing it appears that the regex isn't running in multiline mode so on a file with multiple lines the |
Hmm, this is the internal design of PowerShell's Regular Expressions, not Scoop's. PowerShell's RegEx has many design different with other languages, you could check https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-5.1 for reference.
|
@stevehipwell Can you update the Wiki with this information? |
And it's better to redirect user to MS's help page, since PS's RegEx is neither PCRE nor Perl 😂 |
@niheaven AFAK this is very much a Scoop issue, Scoop chose to run the regexes in singleline mode despite processing multiline files, I'd suggest that this is a bug that should be fixed with the default regex patterns improved to leverage multiline mode. |
PowerShell's default is neither Multiline nor Singleline mode (ref: Singleline Mode, Multiline Mode), and we don't change it since it would meet most of our demands. By default, If we change it to some specific mode, I don't know how many manifest's RegEx may be influenced, a RegEx switch is more better choice. PS, many manifests use |
I don't think it meets most requirements as the |
This tends to be a bug of I'll need some times to deeply check the logic of scoop and PowerShell's RegEx mechanism to figure out what's wrong. |
@niheaven I think you'll need multiline on to make the matches absolute when the input is a multiline file. For cosign I'd have expected As things like SBOMs start to be added to GH artifacts this problem is likely to start showing up more often; I'm surprised this hasn't been a problem in the past but I guess in a lot of cases additional artifacts are generally lower in the order (not that this should be part of the implementation). |
In Changing RegEx's matching mode is a breaking change for scoop, and we need more cases to support this type of change and reviewing existed manifests in all buckets (at least official ones). For now, use option switch |
@niheaven I hadn't tested the multiline modifier, for cosign I think the Scoop default regexs need reviewing, I can't think of a case where not having |
The default is neither Singleline nor Multiline, they both need trigger. I'm afraid changing default behavior to multiline may break some existing RegEx, and if not so, default changing is just one or two lines added. |
Bug Report
Current Behavior
I can't add a
$
to the end of the autoupdate hash regex to make it match the specific artifact rather than another artifact that starts with the same string.Expected Behavior
I'd expect to be able to match an artifact even if there is another artifact earlier in the checksums with the basename as a prefix.
Additional context/output
The
cosign
app in the main bucket is currently broken and it should be fixable by setting"regex": "^$sha256\\s+$basename$"
but this isn't working. The SBOM artifact starts with the artifact name and appears higher in the checksums file.Possible Solution
System details
n/a
The text was updated successfully, but these errors were encountered: