初始化内容
This commit is contained in:
+130
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Input: cmdline docs markdown files, they get modified *in place*
|
||||
#
|
||||
# Strip off the leading meta-data/header part, remove all known curl symbols
|
||||
# and long command line options. Also clean up whatever else the spell checker
|
||||
# might have a problem with that we still deem is fine.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @asyms;
|
||||
|
||||
open(S, "<./docs/libcurl/symbols-in-versions")
|
||||
|| die "cannot find symbols-in-versions";
|
||||
while(<S>) {
|
||||
if(/^([^ ]*) /) {
|
||||
push @asyms, $1;
|
||||
}
|
||||
}
|
||||
close(S);
|
||||
|
||||
# init the opts table with "special" options not easy to figure out
|
||||
my @aopts = (
|
||||
'--ftp-ssl-reqd', # old alias
|
||||
);
|
||||
|
||||
open(O, "<./docs/options-in-versions")
|
||||
|| die "cannot find options-in-versions";
|
||||
while(<O>) {
|
||||
chomp;
|
||||
if(/^([^ ]+)/) {
|
||||
my $o = $1;
|
||||
push @aopts, $o;
|
||||
if($o =~ /^--no-(.*)/) {
|
||||
# for the --no options, also make one without it
|
||||
push @aopts, "--$1";
|
||||
}
|
||||
elsif($o =~ /^--disable-(.*)/) {
|
||||
# for the --disable options, also make the special ones
|
||||
push @aopts, "--$1";
|
||||
push @aopts, "--no-$1";
|
||||
}
|
||||
}
|
||||
}
|
||||
close(O);
|
||||
|
||||
open(C, "<./.github/scripts/spellcheck.curl")
|
||||
|| die "cannot find spellcheck.curl";
|
||||
while(<C>) {
|
||||
if(/^\#/) {
|
||||
next;
|
||||
}
|
||||
chomp;
|
||||
if(/^([^ ]+)/) {
|
||||
push @asyms, $1;
|
||||
}
|
||||
}
|
||||
close(C);
|
||||
|
||||
# longest symbols first
|
||||
my @syms = sort { length($b) <=> length($a) } @asyms;
|
||||
|
||||
# longest cmdline options first
|
||||
my @opts = sort { length($b) <=> length($a) } @aopts;
|
||||
|
||||
sub process {
|
||||
my ($f) = @_;
|
||||
|
||||
my $ignore = 0;
|
||||
my $sepcount = 0;
|
||||
my $out;
|
||||
my $line = 0;
|
||||
open(F, "<$f") or die;
|
||||
|
||||
while(<F>) {
|
||||
$line++;
|
||||
if(/^---/ && ($line == 1)) {
|
||||
$ignore = 1;
|
||||
next;
|
||||
}
|
||||
elsif(/^---/ && $ignore) {
|
||||
$ignore = 0;
|
||||
next;
|
||||
}
|
||||
next if($ignore);
|
||||
|
||||
my $l = $_;
|
||||
|
||||
# strip out backticked words
|
||||
$l =~ s/`[^`]+`//g;
|
||||
|
||||
# **bold**
|
||||
$l =~ s/\*\*(\S.*?)\*\*//g;
|
||||
# *italics*
|
||||
$l =~ s/\*(\S.*?)\*//g;
|
||||
|
||||
# strip out https URLs, we do not want them spellchecked
|
||||
$l =~ s!https://[a-z0-9\#_/.-]+!!gi;
|
||||
|
||||
# strip links, both name and target
|
||||
$l =~ s/(\[.*?\])\(.*?\)//g;
|
||||
$out .= $l;
|
||||
}
|
||||
close(F);
|
||||
|
||||
# cut out all known curl cmdline options
|
||||
map { $out =~ s/$_//g; } (@opts);
|
||||
|
||||
# cut out all known curl symbols
|
||||
map { $out =~ s/\b$_\b//g; } (@syms);
|
||||
|
||||
if(!$ignore) {
|
||||
open(O, ">$f") or die;
|
||||
print O $out;
|
||||
close(O);
|
||||
}
|
||||
}
|
||||
|
||||
my @filemasks = @ARGV;
|
||||
open(my $git_ls_files, '-|', 'git', 'ls-files', '--', @filemasks) or die "Failed running git ls-files: $!";
|
||||
while(my $f = <$git_ls_files>) {
|
||||
chomp $f;
|
||||
process($f);
|
||||
}
|
||||
close $git_ls_files;
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $autotools = $ARGV[0];
|
||||
my $cmake = $ARGV[1];
|
||||
|
||||
if(!$cmake) {
|
||||
print "Usage: cmp-config <config1> <config2.h>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# this lists complete lines that will be removed from the output if
|
||||
# matching
|
||||
my %remove = (
|
||||
'#define CURL_EXTERN_SYMBOL' => 1,
|
||||
'#define CURL_OS "Linux"' => 1,
|
||||
'#define CURL_OS "x86_64-pc-linux-gnu"' => 1,
|
||||
'#define GETHOSTNAME_TYPE_ARG2 int' => 1,
|
||||
'#define GETHOSTNAME_TYPE_ARG2 size_t' => 1,
|
||||
'#define HAVE_BROTLI 1' => 1,
|
||||
'#define HAVE_BROTLI_DECODE_H 1' => 1,
|
||||
'#define HAVE_DLFCN_H 1' => 1,
|
||||
'#define HAVE_GSSAPI_GSSAPI_GENERIC_H 1' => 1,
|
||||
'#define HAVE_GSSAPI_GSSAPI_H 1' => 1,
|
||||
'#define HAVE_GSSAPI_GSSAPI_KRB5_H 1' => 1,
|
||||
'#define HAVE_INTTYPES_H 1' => 1,
|
||||
'#define HAVE_LDAP_H 1' => 1,
|
||||
'#define HAVE_LDAP_SSL 1' => 1,
|
||||
'#define HAVE_LIBBROTLIDEC 1' => 1,
|
||||
'#define HAVE_LIBPSL_H 1' => 1,
|
||||
'#define HAVE_LIBSOCKET 1' => 1,
|
||||
'#define HAVE_LIBSSH' => 1,
|
||||
'#define HAVE_LIBSSH2 1' => 1,
|
||||
'#define HAVE_LIBSSL 1' => 1,
|
||||
'#define HAVE_LIBZSTD 1' => 1,
|
||||
'#define HAVE_NGHTTP2_NGHTTP2_H 1' => 1,
|
||||
'#define HAVE_NGHTTP3_NGHTTP3_H 1' => 1,
|
||||
'#define HAVE_NGTCP2_NGTCP2_CRYPTO_H 1' => 1,
|
||||
'#define HAVE_NGTCP2_NGTCP2_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_CRYPTO_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_ERR_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_PEM_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_RSA_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_SSL_H 1' => 1,
|
||||
'#define HAVE_QUICHE_H 1' => 1,
|
||||
'#define HAVE_SSL_SET_QUIC_TLS_CBS 1' => 1,
|
||||
'#define HAVE_SSL_SET_QUIC_USE_LEGACY_CODEPOINT 1' => 1,
|
||||
'#define HAVE_STDINT_H 1' => 1,
|
||||
'#define HAVE_STDIO_H 1' => 1,
|
||||
'#define HAVE_STDLIB_H 1' => 1,
|
||||
'#define HAVE_STRING_H 1' => 1,
|
||||
'#define HAVE_SYS_STAT_H 1' => 1,
|
||||
'#define HAVE_SYS_XATTR_H 1' => 1,
|
||||
'#define HAVE_UNICODE_UIDNA_H 1' => 1,
|
||||
'#define HAVE_WOLFSSL_SET_QUIC_USE_LEGACY_CODEPOINT 1' => 1,
|
||||
'#define HAVE_ZSTD 1' => 1,
|
||||
'#define HAVE_ZSTD_H 1' => 1,
|
||||
'#define LT_OBJDIR ".libs/"' => 1,
|
||||
'#define NEED_LBER_H 1' => 1,
|
||||
'#define PACKAGE "curl"' => 1,
|
||||
'#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"' => 1,
|
||||
'#define PACKAGE_NAME "curl"' => 1,
|
||||
'#define PACKAGE_STRING "curl -"' => 1,
|
||||
'#define PACKAGE_TARNAME "curl"' => 1,
|
||||
'#define PACKAGE_URL ""' => 1,
|
||||
'#define PACKAGE_VERSION "-"' => 1,
|
||||
'#define VERSION "-"' => 1,
|
||||
'#define _FILE_OFFSET_BITS 64' => 1,
|
||||
);
|
||||
|
||||
sub filter {
|
||||
my ($line) = @_;
|
||||
if(!$remove{$line}) {
|
||||
return "$line\n";
|
||||
}
|
||||
$remove{$line}++;
|
||||
return "";
|
||||
}
|
||||
|
||||
sub grepit {
|
||||
my ($input, $output) = @_;
|
||||
my @defines;
|
||||
# first get all the #define lines
|
||||
open(F, "<$input");
|
||||
while(<F>) {
|
||||
if($_ =~ /^#def/) {
|
||||
chomp;
|
||||
push @defines, $_;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
|
||||
open(O, ">$output");
|
||||
|
||||
# output the sorted list through the filter
|
||||
foreach my $d(sort @defines) {
|
||||
print O filter($d);
|
||||
}
|
||||
close(O);
|
||||
}
|
||||
|
||||
grepit($autotools, "/tmp/autotools");
|
||||
grepit($cmake, "/tmp/cmake");
|
||||
|
||||
foreach my $v (keys %remove) {
|
||||
if($remove{$v} == 1) {
|
||||
print "Ignored, never matched line: $v\n";
|
||||
}
|
||||
}
|
||||
|
||||
# return the exit code from diff
|
||||
exit system('diff', ('-u', '/tmp/autotools', '/tmp/cmake')) >> 8;
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
# Sort list of libs, libpaths, cflags found in libcurl.pc and curl-config files,
|
||||
# then diff the autotools and cmake generated ones.
|
||||
|
||||
sort_lists() {
|
||||
prevline=''
|
||||
section=''
|
||||
while IFS= read -r l; do
|
||||
if [[ "${prevline}" =~ (--cc|--configure) ]]; then # curl-config
|
||||
echo "<IGNORED>"
|
||||
else
|
||||
# libcurl.pc
|
||||
if [[ "${l}" =~ ^(Requires|Libs|Cflags)(\.private)?:\ (.+)$ ]]; then
|
||||
if [ "${BASH_REMATCH[1]}" = 'Requires' ]; then
|
||||
# Spec does not allow duplicates here:
|
||||
# https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html#Requires:
|
||||
# "You may only mention the same package one time on the Requires: line"
|
||||
val="$(printf '%s' "${BASH_REMATCH[3]}" | tr ',' '\n' | sort | tr '\n' ' ')"
|
||||
else
|
||||
val="$(printf '%s' "${BASH_REMATCH[3]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
fi
|
||||
l="${BASH_REMATCH[1]}${BASH_REMATCH[2]}: ${val}"
|
||||
# curl-config
|
||||
elif [[ "${section}" =~ (--libs|--static-libs) && "${l}" =~ ^( *echo\ \")(.+)(\")$ ]]; then
|
||||
val="$(printf '%s' "${BASH_REMATCH[2]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
l="${BASH_REMATCH[1]}${val}${BASH_REMATCH[3]}"
|
||||
section=''
|
||||
fi
|
||||
echo "${l}"
|
||||
fi
|
||||
# curl-config
|
||||
prevline="${l}"
|
||||
if [[ "${l}" =~ --[a-z-]+\) ]]; then
|
||||
section="${BASH_REMATCH[0]}"
|
||||
fi
|
||||
done < "$1"
|
||||
}
|
||||
|
||||
am=$(mktemp -t autotools.XXX); sort_lists "$1" > "${am}"
|
||||
cm=$(mktemp -t cmake.XXX) ; sort_lists "$2" > "${cm}"
|
||||
diff -u "${am}" "${cm}"
|
||||
res="$?"
|
||||
rm -r -f "${am}" "${cm}"
|
||||
|
||||
exit "${res}"
|
||||
@@ -0,0 +1,21 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
anonymou
|
||||
aNULL
|
||||
bu
|
||||
clen
|
||||
CNA
|
||||
hel
|
||||
htpts
|
||||
inout
|
||||
PASE
|
||||
passwor
|
||||
perfec
|
||||
proxys
|
||||
seh
|
||||
ser
|
||||
strat
|
||||
te
|
||||
UE
|
||||
WONT
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git ls-files -z | xargs -0 -r \
|
||||
codespell \
|
||||
--skip '.github/scripts/pyspelling.words' \
|
||||
--skip '.github/scripts/typos.toml' \
|
||||
--skip 'docs/THANKS' \
|
||||
--skip 'projects/OS400/*' \
|
||||
--skip 'projects/vms/*' \
|
||||
--skip 'RELEASE-NOTES' \
|
||||
--skip 'scripts/wcurl' \
|
||||
--skip 'tests/unit/unit1625.c' \
|
||||
--ignore-regex '.*spellchecker:disable-line' \
|
||||
--ignore-words '.github/scripts/codespell-ignore.words' \
|
||||
--
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
# Compare git repo files with tarball files and report a mismatch
|
||||
# after excluding exceptions.
|
||||
|
||||
set -eu
|
||||
|
||||
gitonly=".git*
|
||||
^.*
|
||||
^appveyor.*
|
||||
^GIT-INFO.md
|
||||
^README.md
|
||||
^renovate.json
|
||||
^REUSE.toml
|
||||
^SECURITY.md
|
||||
^LICENSES/*
|
||||
^docs/examples/adddocsref.pl
|
||||
^docs/tests/CI.md
|
||||
^docs/THANKS-filter
|
||||
^projects/Windows/*
|
||||
^scripts/contributors.sh
|
||||
^scripts/contrithanks.sh
|
||||
^scripts/delta
|
||||
^scripts/installcheck.sh
|
||||
^scripts/release-notes.pl
|
||||
^scripts/singleuse.pl"
|
||||
|
||||
tarfiles="$(mktemp)"
|
||||
gitfiles="$(mktemp)"
|
||||
|
||||
tar -tf "$1" \
|
||||
| sed -E 's|^[^/]+/||g' \
|
||||
| grep -v -E '(/|^)$' \
|
||||
| sort > "${tarfiles}"
|
||||
|
||||
git -C "${2:-.}" ls-files \
|
||||
| grep -v -E "($(printf '%s' "${gitonly}" | tr $'\n' '|' | sed -e 's|\.|\\.|g' -e 's|\*|.+|g'))$" \
|
||||
| sort > "${gitfiles}"
|
||||
|
||||
dif="$(diff -u "${tarfiles}" "${gitfiles}" | tail -n +3 || true)"
|
||||
|
||||
rm -rf "${tarfiles:?}" "${gitfiles:?}"
|
||||
|
||||
echo 'Only in tarball:'
|
||||
echo "${dif}" | grep '^-' || true
|
||||
echo
|
||||
|
||||
echo 'Missing from tarball:'
|
||||
if echo "${dif}" | grep '^+'; then
|
||||
exit 1
|
||||
fi
|
||||
+1018
File diff suppressed because it is too large
Load Diff
+33
@@ -0,0 +1,33 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Docs: https://facelessuser.github.io/pyspelling/configuration/
|
||||
# Docs: https://github.com/UnicornGlobal/spellcheck-github-actions
|
||||
matrix:
|
||||
- name: Markdown
|
||||
expect_match: false
|
||||
apsell:
|
||||
mode: en
|
||||
dictionary:
|
||||
wordlists:
|
||||
- wordlist.txt
|
||||
output: wordlist.dic
|
||||
encoding: utf-8
|
||||
pipeline:
|
||||
- pyspelling.filters.markdown:
|
||||
markdown_extensions:
|
||||
- markdown.extensions.extra:
|
||||
- pyspelling.filters.html:
|
||||
comments: true
|
||||
attributes:
|
||||
- title
|
||||
- alt
|
||||
ignores:
|
||||
- ':matches(code, pre)'
|
||||
- 'code'
|
||||
- 'pre'
|
||||
- 'strong'
|
||||
- 'em'
|
||||
sources:
|
||||
- '**/*.md|!docs/BINDINGS.md|!docs/DISTROS.md|!docs/CIPHERS-TLS12.md|!docs/wcurl.md|!tests/data/data*.md'
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Input: number of seconds to run.
|
||||
#
|
||||
# 1. Figure out all existing command line options
|
||||
# 2. Generate random command line using supported options
|
||||
# 3. Run the command line
|
||||
# 4. Verify that it does not return an unexpected return code
|
||||
# 5. Iterate until the time runs out
|
||||
#
|
||||
# Do the same with regular command lines as well as reading the options from a
|
||||
# -K config file
|
||||
#
|
||||
# BEWARE: this may create a large amount of files using random names in the
|
||||
# directory where it runs.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $curl = "../src/curl";
|
||||
my $url = "localhost:7777"; # not listening to this
|
||||
|
||||
my $seconds = $ARGV[0];
|
||||
if($ARGV[1]) {
|
||||
$curl = $ARGV[1];
|
||||
}
|
||||
|
||||
if(!$seconds) {
|
||||
$seconds = 10;
|
||||
}
|
||||
print "Run $curl for $seconds seconds\n";
|
||||
|
||||
my @opt;
|
||||
my %arg;
|
||||
my %uniq;
|
||||
my %allrc;
|
||||
|
||||
my $totalargs = 0;
|
||||
my $totalcmds = 0;
|
||||
|
||||
my $counter = 0xabcdef + time();
|
||||
sub getnum {
|
||||
my ($max) = @_;
|
||||
return int(rand($max));
|
||||
}
|
||||
|
||||
sub storedata {
|
||||
my ($short, $long, $arg) = @_;
|
||||
push @opt, "-$short" if($short);
|
||||
push @opt, "--$long";
|
||||
|
||||
if($arg =~ /^</) {
|
||||
# these take an argument
|
||||
$arg{"-$short"} = $arg if($short);
|
||||
$arg{"--$long"} = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
sub getoptions {
|
||||
my @all = `$curl --help all`;
|
||||
for my $o (@all) {
|
||||
chomp $o;
|
||||
if($o =~ /^ -(.), --([^ ]*) (.*)/) {
|
||||
storedata($1, $2, $3);
|
||||
}
|
||||
elsif($o =~ /^ --([^ ]*) (.*)/) {
|
||||
storedata("", $1, $2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# this adds a fake randomly generated command line option
|
||||
sub addarg {
|
||||
my $nice = "abcdefhijklmnopqrstuvwqxyz".
|
||||
"ABCDEFHIJKLMNOPQRSTUVWQXYZ".
|
||||
"0123456789-";
|
||||
my $len = getnum(20) + 2;
|
||||
my $o;
|
||||
for (1 .. $len) {
|
||||
$o .= substr($nice, getnum(length($nice)), 1);
|
||||
}
|
||||
return "--$o";
|
||||
}
|
||||
|
||||
sub randarg {
|
||||
my $nice = "abcdefhijklmnopqrstuvwqxyz".
|
||||
"ABCDEFHIJKLMNOPQRSTUVWQXYZ".
|
||||
"0123456789".
|
||||
",-?#$%!@ ";
|
||||
my $len = getnum(20);
|
||||
my $o = '';
|
||||
for (1 .. $len) {
|
||||
$o .= substr($nice, getnum(length($nice)), 1);
|
||||
}
|
||||
return "\'$o\'";
|
||||
}
|
||||
|
||||
getoptions();
|
||||
|
||||
my $nopts = scalar(@opt);
|
||||
|
||||
my %useropt = (
|
||||
'-U' => 1,
|
||||
'-u' => 1,
|
||||
'--user' => 1,
|
||||
'--proxy-user' => 1);
|
||||
|
||||
my %commonrc = (
|
||||
'0' => 1,
|
||||
'1' => 1,
|
||||
'2' => 1,
|
||||
'26' => 1,
|
||||
);
|
||||
|
||||
sub runone {
|
||||
my $a;
|
||||
my $nargs = getnum(60) + 1;
|
||||
|
||||
$totalargs += $nargs;
|
||||
$totalcmds++;
|
||||
for (1 .. $nargs) {
|
||||
my $o = getnum($nopts);
|
||||
my $option = $opt[$o];
|
||||
my $ar = "";
|
||||
$uniq{$option}++;
|
||||
if($arg{$option}) {
|
||||
$ar = " ".randarg();
|
||||
|
||||
if($useropt{$option}) {
|
||||
# append password to avoid prompting
|
||||
$ar .= ":".randarg();
|
||||
}
|
||||
}
|
||||
$a .= sprintf(" %s%s", $option, $ar);
|
||||
}
|
||||
if(getnum(100) < 15) {
|
||||
# add a fake arg
|
||||
$a .= " ".addarg();
|
||||
}
|
||||
|
||||
my $cmd="$curl$a $url";
|
||||
|
||||
my $rc = system("$cmd >curl-output 2>&1 </dev/null -M 0.1") >> 8;
|
||||
#my $rc = system("valgrind -q $cmd >/dev/null 2>&1 </dev/null -M 0.1") >> 8;
|
||||
|
||||
$allrc{$rc}++;
|
||||
|
||||
#print "CMD: $cmd\n";
|
||||
if(!$commonrc{$rc}) {
|
||||
print "CMD: $cmd\n";
|
||||
print "RC: $rc\n";
|
||||
print "== curl-output == \n";
|
||||
open(D, "<curl-output");
|
||||
my @out = <D>;
|
||||
print @out;
|
||||
close(D);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
sub runconfig {
|
||||
my $a;
|
||||
my $nargs = getnum(80) + 1;
|
||||
|
||||
open(C, ">config");
|
||||
|
||||
$totalargs += $nargs;
|
||||
$totalcmds++;
|
||||
for (1 .. $nargs) {
|
||||
my $o = getnum($nopts);
|
||||
my $option = $opt[$o];
|
||||
my $ar = "";
|
||||
$uniq{$option} = 0 if(!exists $uniq{$option});
|
||||
$uniq{$option}++;
|
||||
if($arg{$option}) {
|
||||
$ar = " ".randarg();
|
||||
|
||||
if($useropt{$option}) {
|
||||
# append password
|
||||
$ar .= ":".randarg();
|
||||
}
|
||||
}
|
||||
$a .= sprintf("\n%s%s", $option, $ar);
|
||||
}
|
||||
if(getnum(100) < 15) {
|
||||
# add a fake arg
|
||||
$a .= "\n".addarg();
|
||||
}
|
||||
|
||||
print C "$a\n";
|
||||
close(C);
|
||||
|
||||
my $cmd="$curl -K config $url";
|
||||
|
||||
my $rc = system("$cmd >curl-output 2>&1 </dev/null -M 0.1") >> 8;
|
||||
|
||||
$allrc{$rc}++;
|
||||
|
||||
if(!$commonrc{$rc}) {
|
||||
print "CMD: $cmd\n";
|
||||
print "RC: $rc\n";
|
||||
print "== config == \n";
|
||||
open(D, "<config");
|
||||
my @all = <D>;
|
||||
print @all;
|
||||
close(D);
|
||||
print "\n== curl-output == \n";
|
||||
open(D, "<curl-output");
|
||||
my @out = <D>;
|
||||
print @out;
|
||||
close(D);
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
|
||||
# run curl command lines using -K
|
||||
my $end = time() + $seconds/2;
|
||||
my $c = 0;
|
||||
print "Running command lines\n";
|
||||
do {
|
||||
runconfig();
|
||||
$c++;
|
||||
} while(time() <= $end);
|
||||
print "$c command lines\n";
|
||||
|
||||
# run curl command lines
|
||||
$end = time() + $seconds/2;
|
||||
$c = 0;
|
||||
print "Running config lines\n";
|
||||
do {
|
||||
runone();
|
||||
$c++;
|
||||
} while(time() <= $end);
|
||||
|
||||
print "$c config line uses\n";
|
||||
|
||||
print "Recorded exit codes:\n";
|
||||
for my $rc (keys %allrc) {
|
||||
printf " %2d: %d times\n", $rc, $allrc{$rc};
|
||||
}
|
||||
printf "Number or command lines tested:\n".
|
||||
" $totalcmds (%.1f/second)\n", $totalcmds/$seconds;
|
||||
printf "Number or command line options tested:\n".
|
||||
" $totalargs (average %.1f per command line)\n",
|
||||
$totalargs/$totalcmds;
|
||||
printf "Number or different options tested:\n".
|
||||
" %u out of %u\n", scalar(keys %uniq), $nopts;
|
||||
@@ -0,0 +1,5 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
pyspelling==2.12.1
|
||||
@@ -0,0 +1,5 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
proselint==0.16.0
|
||||
@@ -0,0 +1,9 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
cmakelang==0.6.13
|
||||
codespell==2.4.2
|
||||
pytype==2024.10.11
|
||||
reuse==6.2.0
|
||||
ruff==0.15.10
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
# Required: yq
|
||||
|
||||
set -eu
|
||||
|
||||
export SHELLCHECK_OPTS='--exclude=1090,1091,2086,2153 --enable=avoid-nullary-conditions,deprecate-which'
|
||||
|
||||
# GHA
|
||||
git ls-files '.github/workflows/*.yml' | while read -r f; do
|
||||
echo "Verifying ${f}..."
|
||||
{
|
||||
echo '#!/usr/bin/env bash'
|
||||
echo 'set -eu'
|
||||
yq eval '.. | select(has("run") and (.run | type == "!!str")) | .run + "\ntrue\n"' "${f}"
|
||||
} | sed -E 's|\$\{\{ .+ \}\}|GHA_EXPRESSION|g' | shellcheck -
|
||||
done
|
||||
|
||||
# Circle CI
|
||||
git ls-files '.circleci/*.yml' | while read -r f; do
|
||||
echo "Verifying ${f}..."
|
||||
{
|
||||
echo '#!/usr/bin/env bash'
|
||||
echo 'set -eu'
|
||||
yq eval '.. | select(has("command") and (.command | type == "!!str")) | .command + "\ntrue\n"' "${f}"
|
||||
} | shellcheck -
|
||||
done
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git grep -z -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' | xargs -0 -r \
|
||||
shellcheck --exclude=1091,2248 \
|
||||
--enable=avoid-nullary-conditions,deprecate-which \
|
||||
--
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# common variable types + structs
|
||||
# callback typedefs
|
||||
# public functions names
|
||||
# some man page names
|
||||
curl_fileinfo
|
||||
curl_forms
|
||||
curl_hstsentry
|
||||
curl_httppost
|
||||
curl_index
|
||||
curl_khkey
|
||||
curl_pushheaders
|
||||
curl_waitfd
|
||||
CURLcode
|
||||
CURLformoption
|
||||
CURLHcode
|
||||
CURLMcode
|
||||
CURLMsg
|
||||
CURLSHcode
|
||||
CURLUcode
|
||||
curl_calloc_callback
|
||||
curl_chunk_bgn_callback
|
||||
curl_chunk_end_callback
|
||||
curl_conv_callback
|
||||
curl_debug_callback
|
||||
curl_fnmatch_callback
|
||||
curl_formget_callback
|
||||
curl_free_callback
|
||||
curl_hstsread_callback
|
||||
curl_hstswrite_callback
|
||||
curl_ioctl_callback
|
||||
curl_malloc_callback
|
||||
curl_multi_timer_callback
|
||||
curl_opensocket_callback
|
||||
curl_prereq_callback
|
||||
curl_progress_callback
|
||||
curl_push_callback
|
||||
curl_read_callback
|
||||
curl_realloc_callback
|
||||
curl_resolver_start_callback
|
||||
curl_seek_callback
|
||||
curl_socket_callback
|
||||
curl_sockopt_callback
|
||||
curl_ssl_ctx_callback
|
||||
curl_strdup_callback
|
||||
curl_trailer_callback
|
||||
curl_write_callback
|
||||
curl_xferinfo_callback
|
||||
curl_strequal
|
||||
curl_strnequal
|
||||
curl_mime_init
|
||||
curl_mime_free
|
||||
curl_mime_addpart
|
||||
curl_mime_name
|
||||
curl_mime_filename
|
||||
curl_mime_type
|
||||
curl_mime_encoder
|
||||
curl_mime_data
|
||||
curl_mime_filedata
|
||||
curl_mime_data_cb
|
||||
curl_mime_subparts
|
||||
curl_mime_headers
|
||||
curl_formadd
|
||||
curl_formget
|
||||
curl_formfree
|
||||
curl_getdate
|
||||
curl_getenv
|
||||
curl_version
|
||||
curl_easy_escape
|
||||
curl_escape
|
||||
curl_easy_unescape
|
||||
curl_unescape
|
||||
curl_free
|
||||
curl_global_init
|
||||
curl_global_init_mem
|
||||
curl_global_cleanup
|
||||
curl_global_trace
|
||||
curl_global_sslset
|
||||
curl_slist_append
|
||||
curl_slist_free_all
|
||||
curl_getdate
|
||||
curl_share_init
|
||||
curl_share_setopt
|
||||
curl_share_cleanup
|
||||
curl_version_info
|
||||
curl_easy_strerror
|
||||
curl_share_strerror
|
||||
curl_easy_pause
|
||||
curl_easy_ssls_import
|
||||
curl_easy_ssls_export
|
||||
curl_easy_init
|
||||
curl_easy_setopt
|
||||
curl_easy_perform
|
||||
curl_easy_cleanup
|
||||
curl_easy_getinfo
|
||||
curl_easy_duphandle
|
||||
curl_easy_reset
|
||||
curl_easy_recv
|
||||
curl_easy_send
|
||||
curl_easy_upkeep
|
||||
curl_easy_header
|
||||
curl_easy_nextheader
|
||||
curl_mprintf
|
||||
curl_mfprintf
|
||||
curl_msprintf
|
||||
curl_msnprintf
|
||||
curl_mvprintf
|
||||
curl_mvfprintf
|
||||
curl_mvsprintf
|
||||
curl_mvsnprintf
|
||||
curl_maprintf
|
||||
curl_mvaprintf
|
||||
curl_multi_init
|
||||
curl_multi_add_handle
|
||||
curl_multi_remove_handle
|
||||
curl_multi_fdset
|
||||
curl_multi_waitfds
|
||||
curl_multi_wait
|
||||
curl_multi_poll
|
||||
curl_multi_wakeup
|
||||
curl_multi_perform
|
||||
curl_multi_cleanup
|
||||
curl_multi_info_read
|
||||
curl_multi_strerror
|
||||
curl_multi_socket
|
||||
curl_multi_socket_action
|
||||
curl_multi_socket_all
|
||||
curl_multi_timeout
|
||||
curl_multi_setopt
|
||||
curl_multi_assign
|
||||
curl_multi_get_handles
|
||||
curl_multi_get_offt
|
||||
curl_multi_notify_disable
|
||||
curl_multi_notify_enable
|
||||
curl_pushheader_bynum
|
||||
curl_pushheader_byname
|
||||
curl_easy_option_by_name
|
||||
curl_easy_option_by_id
|
||||
curl_easy_option_next
|
||||
curl_url
|
||||
curl_url_cleanup
|
||||
curl_url_dup
|
||||
curl_url_get
|
||||
curl_url_set
|
||||
curl_url_strerror
|
||||
curl_ws_recv
|
||||
curl_ws_send
|
||||
curl_ws_meta
|
||||
libcurl-env
|
||||
libcurl-ws
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Given: a libcurl curldown man page
|
||||
# Outputs: the same file, minus the header
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $f = $ARGV[0] || '';
|
||||
|
||||
open(F, "<$f") or die;
|
||||
|
||||
my @out;
|
||||
my $line = 0;
|
||||
my $hideheader = 0;
|
||||
|
||||
while(<F>) {
|
||||
if($hideheader) {
|
||||
if(/^---/) {
|
||||
# end if hiding
|
||||
$hideheader = 0;
|
||||
}
|
||||
push @out, "\n"; # replace with blank
|
||||
next;
|
||||
}
|
||||
elsif(!$line++ && /^---/) {
|
||||
# starts with a header, strip off the header
|
||||
$hideheader = 1;
|
||||
push @out, "\n"; # replace with blank
|
||||
next;
|
||||
}
|
||||
push @out, $_;
|
||||
}
|
||||
close(F);
|
||||
|
||||
open(O, ">$f") or die;
|
||||
for my $l (@out) {
|
||||
print O $l;
|
||||
}
|
||||
close(O);
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git ls-files | typos \
|
||||
--isolated \
|
||||
--force-exclude \
|
||||
--config '.github/scripts/typos.toml' \
|
||||
--file-list -
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
[default]
|
||||
extend-ignore-identifiers-re = [
|
||||
"^(ba|fo|pn|PN|UE)$",
|
||||
"^(CNA|cpy|ser)$",
|
||||
"^(ECT0|ECT1|HELO|htpts|PASE)$",
|
||||
"^[A-Za-z0-9_-]*(EDE|GOST)[A-Z0-9_-]*$", # ciphers
|
||||
"^0x[0-9a-fA-F]+FUL$", # unsigned long hex literals ending with 'F'
|
||||
"^[0-9a-zA-Z+]{64,}$", # possibly base64
|
||||
"^(eyeballers|HELO_smtp|Januar|optin|passin|perfec|SMTP_HELO)$",
|
||||
"^(clen|req_clen|smtp_perform_helo|smtp_state_helo_resp|Tru64|_stati64)$",
|
||||
"(_ccontains|_controllen|O_WRONLY|secur32)",
|
||||
"proxys", # this should be limited to tests/http/*. Short for secure proxy.
|
||||
]
|
||||
|
||||
extend-ignore-re = [
|
||||
".*spellchecker:disable-line",
|
||||
]
|
||||
|
||||
[files]
|
||||
extend-exclude = [
|
||||
".github/scripts/codespell-ignore.words",
|
||||
".github/scripts/pyspelling.words",
|
||||
"docs/THANKS",
|
||||
"projects/OS400/*",
|
||||
"projects/vms/*",
|
||||
"projects/Windows/tmpl/curl.vcxproj",
|
||||
"projects/Windows/tmpl/libcurl.vcxproj",
|
||||
"RELEASE-NOTES",
|
||||
"scripts/wcurl",
|
||||
"tests/data/test*",
|
||||
"tests/unit/unit1625.c",
|
||||
]
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @files = @ARGV;
|
||||
my $cfile = "test.c";
|
||||
my $check = "./scripts/checksrc.pl";
|
||||
my $error = 0;
|
||||
|
||||
if(!@files || $files[0] eq "-h") {
|
||||
print "Usage: verify-examples [markdown pages]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub testcompile {
|
||||
my $rc = system('gcc -c test.c -I include -W -Wall -pedantic -Werror ' .
|
||||
'-Wno-unused-parameter -Wno-unused-but-set-variable ' .
|
||||
'-DCURL_ALLOW_OLD_MULTI_SOCKET -DCURL_DISABLE_DEPRECATION') >> 8;
|
||||
return $rc;
|
||||
}
|
||||
|
||||
sub checksrc {
|
||||
my $rc = system($check, ('test.c')) >> 8;
|
||||
return $rc;
|
||||
}
|
||||
|
||||
sub extract {
|
||||
my($f) = @_;
|
||||
my $syn = 0;
|
||||
my $l = 0;
|
||||
my $iline = 0;
|
||||
my $fail = 0;
|
||||
open(F, "<$f") or die "failed opening input file $f : $!";
|
||||
open(O, ">$cfile") or die "failed opening output file $cfile : $!";
|
||||
print O "#include <curl/curl.h>\n";
|
||||
while(<F>) {
|
||||
$iline++;
|
||||
if(/^# EXAMPLE/) {
|
||||
$syn = 1
|
||||
}
|
||||
elsif($syn == 1) {
|
||||
if(/^~~~/) {
|
||||
$syn++;
|
||||
print O "/* !checksrc! disable BANNEDFUNC all */\n"; # for fopen()
|
||||
print O "/* !checksrc! disable COPYRIGHT all */\n";
|
||||
print O "/* !checksrc! disable UNUSEDIGNORE all */\n";
|
||||
printf O "#line %d \"$f\"\n", $iline+1;
|
||||
}
|
||||
}
|
||||
elsif($syn == 2) {
|
||||
if(/^~~~/) {
|
||||
last;
|
||||
}
|
||||
# two backslashes become one
|
||||
$_ =~ s/\\\\/\\/g;
|
||||
print O $_;
|
||||
$l++;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
close(O);
|
||||
|
||||
return ($fail ? 0 : $l);
|
||||
}
|
||||
|
||||
my $count = 0;
|
||||
for my $m (@files) {
|
||||
#print "Verify $m\n";
|
||||
my $out = extract($m);
|
||||
if($out) {
|
||||
$error |= testcompile($m);
|
||||
$error |= checksrc($m);
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if(!$error) {
|
||||
print "Verified $count man pages ok\n";
|
||||
}
|
||||
else {
|
||||
print "Detected problems\n";
|
||||
}
|
||||
exit $error;
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @files = @ARGV;
|
||||
my $cfile = "test.c";
|
||||
|
||||
if(!@files || $files[0] eq "-h") {
|
||||
print "Usage: verify-synopsis [man pages]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub testcompile {
|
||||
my $rc = system('gcc -c test.c -I include -W -Wall -pedantic -Werror ' .
|
||||
'-DCURL_ALLOW_OLD_MULTI_SOCKET -DCURL_DISABLE_TYPECHECK') >> 8;
|
||||
return $rc;
|
||||
}
|
||||
|
||||
sub extract {
|
||||
my($f) = @_;
|
||||
my $syn = 0;
|
||||
my $l = 0;
|
||||
my $iline = 0;
|
||||
open(F, "<$f");
|
||||
open(O, ">$cfile");
|
||||
while(<F>) {
|
||||
$iline++;
|
||||
if(/^# SYNOPSIS/) {
|
||||
$syn = 1
|
||||
}
|
||||
elsif($syn == 1) {
|
||||
if(/^\~\~\~/) {
|
||||
$syn++;
|
||||
print O "#line $iline \"$f\"\n";
|
||||
}
|
||||
}
|
||||
elsif($syn == 2) {
|
||||
if(/^\~\~\~/) {
|
||||
last;
|
||||
}
|
||||
# turn the vararg argument into vararg
|
||||
$_ =~ s/, parameter\)\;/, ...);/;
|
||||
print O $_;
|
||||
$l++;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
close(O);
|
||||
|
||||
if($syn < 2) {
|
||||
print STDERR "Found no synopsis in $f\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $error;
|
||||
for my $m (@files) {
|
||||
$error |= extract($m);
|
||||
$error |= testcompile($m);
|
||||
}
|
||||
exit $error;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git ls-files '*.yaml' '*.yml' -z | xargs -0 -r \
|
||||
yamllint \
|
||||
--format standard \
|
||||
--strict \
|
||||
--config-data .github/scripts/yamlcheck.yaml \
|
||||
--
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Docs: https://yamllint.readthedocs.io/en/stable/configuration.html
|
||||
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 500
|
||||
level: warning
|
||||
|
||||
braces: disable
|
||||
commas: disable
|
||||
comments: disable
|
||||
document-start: disable
|
||||
Reference in New Issue
Block a user