Skip to content

scripts: enable strict warnings in Perl where missing, fix fallouts#17877

Closed
vszakats wants to merge 65 commits intocurl:masterfrom
vszakats:perl-w-fatal
Closed

scripts: enable strict warnings in Perl where missing, fix fallouts#17877
vszakats wants to merge 65 commits intocurl:masterfrom
vszakats:perl-w-fatal

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jul 9, 2025

  • add 'use warnings' and 'use strict' where missing from Perl scripts.
  • fix 'Use of uninitialized value'.
  • fix missing declarations.
  • test1140.pl: fix 'Possible precedence issue with control flow operator'.
  • fix other misc issues.

Most actual errors found during this PR were fixed and merged via
separate PRs.

Likely there are remaining warnings not found and fixed in this PR.


@vszakats vszakats added the tests label Jul 9, 2025
@vszakats vszakats marked this pull request as draft July 9, 2025 19:21
@github-actions github-actions bot added the CI Continuous Integration label Jul 9, 2025
@vszakats

This comment was marked as resolved.

vszakats added a commit to vszakats/curl that referenced this pull request Jul 9, 2025
Fix test1175 to pass the correct source root directory.
Before this patch this caused a silent failure and the tests didn't run.

With this fixed, it detected these issues:
```
CURLE_FUNCTION_NOT_FOUND is not in libcurl-errors.md
CURLE_HTTP_POST_ERROR is not in libcurl-errors.md
CURLE_TELNET_OPTION_SYNTAX is not in libcurl-errors.md
CURLM_CALL_MULTI_SOCKET is not in libcurl-errors.md
```

Fix them by:
- marking `CURLE_FUNCTION_NOT_FOUND` deprecated by 7.53.0
- marking `CURLE_HTTP_POST_ERROR` deprecated by 7.56.0
- marking `CURLE_TELNET_OPTION_SYNTAX` deprecated by 7.78.0
- documenting `CURLM_CALL_MULTI_SOCKET` as a synonym for
  `CURLM_CALL_MULTI_PERFORM`

But, these weren't officially deprecated. It may need more
updates to reflect that in other places, or fix the issues
differently.

Cherry-picked from curl#17877
@vszakats vszakats force-pushed the perl-w-fatal branch 2 times, most recently from 9c7f62c to f90e62d Compare July 11, 2025 00:02
vszakats added a commit that referenced this pull request Jul 11, 2025
Fix test 1175 by passing the source root directory (was: tests).

Before this patch this caused silent Perl warnings and returning success
without executing the tests, due to:
```
readline() on closed filehandle $f at ../../tests/test1175.pl line 55.
readline() on closed filehandle $f at ../../tests/test1175.pl line 39.
```

Running the test revealed these issues:
```
CURLE_FUNCTION_NOT_FOUND is not in libcurl-errors.md
CURLE_HTTP_POST_ERROR is not in libcurl-errors.md
CURLE_TELNET_OPTION_SYNTAX is not in libcurl-errors.md
CURLM_CALL_MULTI_SOCKET is not in libcurl-errors.md
```

Apply fixes:
- mark `CURLE_FUNCTION_NOT_FOUND` deprecated by 7.53.0
- mark `CURLE_HTTP_POST_ERROR` deprecated by 7.56.0
- mark `CURLE_TELNET_OPTION_SYNTAX` deprecated by 7.78.0
- document `CURLM_CALL_MULTI_SOCKET` as a synonym for
  `CURLM_CALL_MULTI_PERFORM`
- test1477: exclude `CURLM_CALL_MULTI_SOCKET`.

But, these weren't officially deprecated. It may need more updates
to reflect that in other places, or fix the issues differently.

Follow-up to 66ec950 #12424
Follow-up to 74f441c #4628

Cherry-picked from #17877
Closes #17880
vszakats added a commit that referenced this pull request Jul 11, 2025
Before this patch this test succeeded silently and unconditionally,
when run on an out-of-tree curl build.

Also fix to exit gracefully if no libcurl manuals are found.

Fixing:
```
readline() on closed filehandle $m at ../../tests/test1222.pl line 153.
```

Cherry-picked from #17877
Closes #17892
@vszakats vszakats mentioned this pull request Jul 11, 2025
vszakats added a commit that referenced this pull request Jul 11, 2025
Cherry-picked from #17877
Cherry-picked from #17876

Closes #17896
@vszakats vszakats changed the title [TEST] tests: make perl warnings fatal scripts: enable strict warnings in perl where missing, fix fallouts Jul 11, 2025
vszakats added a commit to vszakats/curl that referenced this pull request Jul 11, 2025
Replacing a regex, for portability.

Cherry-picked from curl#17877
vszakats added a commit that referenced this pull request Jul 12, 2025
Follow-up to 8eab2b7 #17896
Cherry-picked from #17877
Closes #17901
vszakats added a commit that referenced this pull request Jul 12, 2025
Also:
- fix the generated output in repo files.

Cherry-picked from #17877
Closes #17903
vszakats added a commit that referenced this pull request Jul 14, 2025
Replacing a regex, for portability.

Reported-by: Stefan Eissing
Bug: #17871 (comment)

Cherry-picked from #17877
Closes #17900
@vszakats vszakats changed the title scripts: enable strict warnings in perl where missing, fix fallouts scripts: enable strict warnings in Perl where missing, fix fallouts Jul 14, 2025
vszakats added a commit to vszakats/curl that referenced this pull request Jul 14, 2025
@vszakats vszakats closed this in 2ec5455 Jul 27, 2025
@vszakats vszakats deleted the perl-w-fatal branch July 27, 2025 20:36
vszakats added a commit that referenced this pull request Jul 27, 2025
```
Use of uninitialized value $errors in exit at .github/scripts/badwords.pl line 87.
Use of uninitialized value $o in concatenation (.) or string at ../.github/scripts/randcurl.pl line 99.
```

Follow-up to 2ec5455 #17877
Cherry-picked from #18042
Closes #18047
vszakats added a commit that referenced this pull request Jul 28, 2025
Also fix possibly missing reallocated memory from 'Total allocated':
```
Use of uninitialized value $size in addition (+) at tests/memanalyze.pl line 240, <$fileh> line 4.
```
Ref: https://github.com/curl/curl/actions/runs/16565283280/job/46843800711?pr=18049#step:39:3834

Ref: https://github.com/curl/curl/actions/runs/16556860012/job/46819517495?pr=17927#step:39:156
Follow-up to fc98a63 #18048
Follow-up to 2ec5455 #17877
Closes #18049
vszakats added a commit that referenced this pull request Jul 28, 2025
It makes the script run on BSD-like envs.

Follow-up to f63bdea #18058
Follow-up to 2ec5455 #17877

Closes #18061
vszakats added a commit that referenced this pull request Jul 30, 2025
AM libressl heimdal:
```
Global symbol "$verbose" requires explicit package name (did you forget to declare "my $verbose"?) at tests/http2-server.pl line 52.
Global symbol "$certfile" requires explicit package name (did you forget to declare "my $certfile"?) at tests/http2-server.pl line 109.
Global symbol "$keyfile" requires explicit package name (did you forget to declare "my $keyfile"?) at tests/http2-server.pl line 110.
Execution of tests/http2-server.pl aborted due to compilation errors.
[...]
```
Ref: https://github.com/curl/curl/actions/runs/16622030370/job/47028537336?pr=18099#step:39:3148

Follow-up to 2ec5455 #17877

Closes #18100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant

Comments