-
Notifications
You must be signed in to change notification settings - Fork 242
maint: introduce LintMan to aid on tracking/updating values and fix pcre2limits.3 for the correct name length #776
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #!/usr/bin/perl | ||
|
|
||
| use warnings; | ||
| use strict; | ||
| use Getopt::Long; | ||
| use vars qw /$opt_verbose/; | ||
|
|
||
| # A script to scan PCRE2's man pages to check for values that might need to | ||
| # be updated to match the code. | ||
| # | ||
| # It updates numerical values after \" DEFINE <name> or errors if name is | ||
| # not found. | ||
|
|
||
| my $file; | ||
| my %defs; | ||
|
|
||
| foreach $file ("../src/config.h.generic") | ||
| { | ||
| open (INCLUDE, $file) or die "Failed to open include $file\n"; | ||
|
|
||
| while (<INCLUDE>) | ||
| { | ||
| next unless /^#define ([[:upper:]_\d]+)\s+(\d+)/a; | ||
| $defs{$1} = $2; | ||
| } | ||
|
|
||
| close(INCLUDE); | ||
| } | ||
|
|
||
| GetOptions("verbose"); | ||
| while (scalar(@ARGV) > 0) | ||
| { | ||
| $file = shift @ARGV; | ||
|
|
||
| open my $fh, "+<", $file or die "Failed to open $file\n"; | ||
|
|
||
| my @lines = <$fh>; | ||
| my $updated = 0; | ||
|
|
||
| foreach my $index (0 .. $#lines) | ||
| { | ||
| if ($lines[$index] =~ /^\.\\"\sDEFINE\s([[:upper:]_\d]+)$/a) | ||
| { | ||
| my $l = $index + 1; | ||
| die "Invalid DEFINE line $l of $file\n" unless defined $lines[$l]; | ||
|
|
||
| my $key = $1; | ||
| die "Bad DEFINE key $key line $l of $file\n" unless exists $defs{$key}; | ||
|
|
||
| my $value = $defs{$key}; | ||
| if ($lines[$index + 1] !~ /^$value\b/) | ||
| { | ||
| $updated += $lines[$index + 1] =~ s/^\d+/$value/a; | ||
| print "Updated $key in $file to $value\n" if $opt_verbose; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if ($updated > 0) | ||
| { | ||
| seek($fh, 0, 0); | ||
| print $fh @lines; | ||
| truncate($fh, tell($fh)); | ||
| } | ||
| close($fh); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made one change here. If the user configures their PCRE2 differently, they should still (probably) get the same documentation is everyone else?
I've made the docs match the generic config. Users don't receive the maintainer scripts in
maint/as part of a tarball release, so they won't be customising the values in the docs for their installation anyway.Finally, I've checked that it's running nicely in CI - and it seems to work well. Great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but isn't config.h.generic created by the Makefile?
in that scenario, if a new setting is added to the documentation then this will break CI, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if you want to reference a new constant using your
.\" DEFINEsyntax then it has to be defined in config.h. That's not really changed from what you did.config.h.genericis just an exact copy ofconfig.hwhen you run./configurewith no arguments, so the two config files always have the same constants in.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I only change config.h.in, and
configurecreates config.h, and aftermakeruns thenconfig.h.genericis created from it.but the CI checks for that last file, which hasn't been updated yet because
configureandmakedidn't run yet, right?, and whenLintManruns finds aDEFINEthat doesn't exist in that file and dies.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI ensures that
config.h.genericis kept up to date.