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

verify-examples.pl: fail verification on unescaped backslash #12589

Closed
wants to merge 4 commits into from

Conversation

jay
Copy link
Member

@jay jay commented Dec 23, 2023

  • Check that all backslashes in EXAMPLE are properly escaped.

eg manpage must always use \\n never \n.

This is because the manpage requires we always double blackslash to show a single backslash. Prior to this change an erroneous single backslash would pass through and compile even though it would not show correctly in the manpage.

Ref: #12588

Closes #xxxx


Note I also added die for failed open of input/output.

- Check that all backslashes in EXAMPLE are properly escaped.

eg manpage must always use `\\n` never `\n`.

This is because the manpage requires we always double blackslash to show
a single backslash. Prior to this change an erroneous single backslash
would pass through and compile even though it would not show correctly
in the manpage.

Ref: curl#12588

Closes #xxxx
@github-actions github-actions bot added CI Continuous Integration script labels Dec 23, 2023
@jay
Copy link
Member Author

jay commented Dec 23, 2023

For some reason the CI job manpage examples / verify (pull_request) -- which runs verify-examples.pl to verify the manpage examples -- isn't running on the commits in this PR.

@bagder
Copy link
Member

bagder commented Dec 24, 2023

Does it need this?

diff --git a/.github/workflows/man-examples.yml b/.github/workflows/man-examples.yml
index 080cb4c2d..640e3716c 100644
--- a/.github/workflows/man-examples.yml
+++ b/.github/workflows/man-examples.yml
@@ -10,16 +10,18 @@ on:
       - master
       - '*/ci'
     paths:
       - 'docs/libcurl/curl_*.3'
       - 'docs/libcurl/opts/*.3'
+      - '.github/scripts/verify-examples.pl'
   pull_request:
     branches:
       - master
     paths:
       - 'docs/libcurl/curl_*.3'
       - 'docs/libcurl/opts/*.3'
+      - '.github/scripts/verify-examples.pl'
 
 jobs:
   verify:
     runs-on: ubuntu-latest
     steps:

@jay
Copy link
Member Author

jay commented Dec 24, 2023

Does it need this?

oh maybe. let's find out...

@bagder
Copy link
Member

bagder commented Dec 27, 2023

How about this take?

diff --git a/.github/scripts/verify-examples.pl b/.github/scripts/verify-examples.pl
index 8c8fed11b..4b4ff5810 100755
--- a/.github/scripts/verify-examples.pl
+++ b/.github/scripts/verify-examples.pl
@@ -73,10 +73,11 @@ sub extract {
                 print STDERR
                   "Error while processing file $f line $iline:\n$_" .
                   "Error: Single backslashes \\ are not properly shown in " .
                   "manpage EXAMPLE output unless they are escaped \\\\.\n";
                 $fail = 1;
+                $error++;
                 last;
             }
             # two backslashes become one
             $_ =~ s/\\\\/\\/g;
             print O $_;
@@ -95,10 +96,7 @@ for my $m (@files) {
     my $out = extract($m);
     if($out) {
       $error |= testcompile($m);
       $error |= checksrc($m);
     }
-    else {
-      $error = 1;
-    }
 }
 exit $error;

@jay jay closed this in aa2c2ab Dec 28, 2023
@jay jay deleted the verifyexamples branch December 28, 2023 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration documentation script
Development

Successfully merging this pull request may close these issues.

None yet

2 participants