From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id A95B51FF09B for ; Mon, 28 Sep 2026 09:16:59 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2160A21924; Mon, 28 Sep 2026 09:15:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790340460; x=1790945260; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=dcETNY7JrqoQ/4/XimOluiLo+X2r2f5V1NenZiFIiXk=; b=eZq33sDNmWBzQAu1/bnP5zPjH8FnyQj1QD/iPJDgjVRuWTyLbvbs0YuJGgoKEdtevj enrUFFs6SFzPbhZbF7NSTbhc+T9Zz+Ur6SR39MWid8pl3OwU6rFBcZdmAGFYHjd6lfWr NYEho/shoDH/7MNFdvNGxRFlvNgW7ujPGv4hJR1syvinhe359D4KGGCeMzjKeibFArJL XUUJdLmUTPsC8oJ/kbv7zFnz6/sdv11p9NzOHpC++UcPjsVsG+aXK5vQljkwPv0sG7Qe oXMtIJfPdlN42L9a2KkVMLaSpZzglFETJXkG34CmSZHR4WOpjMd0TihDP//T7RvzDbFa 2Kug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790340460; x=1790945260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=dcETNY7JrqoQ/4/XimOluiLo+X2r2f5V1NenZiFIiXk=; b=DLyYMGmRg0qZXXsXtNoMY/ZxCy1Eo2Hg4z9MInAwyzqgk8cCZXsb7oo61KjMxc1mCi xxS6Qaj0E1YZ5Cefipe5aYhx+f1ErtE5AfbtmU6DEs9RjO2iUiltfetrnMfOHisBWjYi yEvqnCCaJyK7sc9SG0UFJdRRR2fXyQtH5Jkgs5Y63Z0JmhcfG/uZria7bETLJC0i+tQG DI8dAwUmCpG+FsxPIDJWGPCBGwhA7NQ4buh5XO5M/EMedhrhzG+lI3d164pYIpFVMTvH qm1uCFEO0izoyQNdI9dUbQt5fieDi/wC4iJQF6XgYbrJnRcSCEt0EWDtSXIGyMH7AiEQ uxkw== X-Gm-Message-State: AFuF++nD1nlxH5qdaS6JsyuuJ9A9FEDtgmjxJp69H2XD6jJUeqhnShSP lSPDz1TjC1KWEOwCAVivjCwuUS5rTI9pA/YkMRDItRhhSwoKdD+c/dlOY/ogmTOx X-Gm-Gg: AYBFou31nnTo8XzzOmGnLFDnyEaW5XaIPq2teLVYS4yVf3SUlepx/24Ks0EDfwtB9PK xbuY0EcYxBuHajBrBKFwfo2Nm7JFVFd6igTrZFBaIGDAgiRNsJ6BRbEt2lURFbl9UKXnM91RQ9O uMjmZQa2E6RQLN1+7epP9Z77g39/nTKGAOmnjUmoANKjteCAzXpQLkxnCj4EtOQFxcu8ptIY6u0 KJhCCJs+TSdgNzQ2V/5R/lvlWny2lldV6YQo1sfXHa1R8K5rQ4POqKR2153O+Leh4HHTMvqaZaW VMvAN1kFlx1wtB4enWqKqiU/RbReWduYJ68AuuicQgoj0qGMOdmSP5QGfSP0Fsh9M0F4D/ZGo+g JAGb4WrbRG21znE+9PiWJPKNaDmNCiKN6RrohG9Y0QiusAVie/S7cud/hbGiI4sTuAhefM70xPF CwjXjiwsjUknmKP4X1Vh75uOPnEfBfKNaqMTfdWOmMjky7YGfW4C4XOQlNSA7NvQ0cm8CMEqJWR Sy1SCq1yRiAek4Ii9PqTzD4wKdPWXgy61XZ6ZNTP3m6MWqFTLs= X-Received: by 2002:a05:600c:540e:b0:49f:cbf1:e77b with SMTP id 5b1f17b1804b1-49fe66ca828mr100656065e9.10.1790340460343; Fri, 25 Sep 2026 05:47:40 -0700 (PDT) From: Mathias Bartmann To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-acme 3/3] tests: rewrite check-missing-functions to catch calls in substitutions Date: Fri, 25 Sep 2026 14:47:37 +0200 Message-ID: <20260925124737.42866-4-mathias.bartmann@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260925124737.42866-1-mathias.bartmann@gmail.com> References: <20260925124737.42866-1-mathias.bartmann@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.166 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider KAM_SHORT 0.001 Use of a URL Shortener for very short URL SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: mathias.bartmann@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: LHGPDFEFY3GJDXKVOORUIOMBSJX7ZFNW X-Message-ID-Hash: LHGPDFEFY3GJDXKVOORUIOMBSJX7ZFNW X-Mailman-Approved-At: Mon, 28 Sep 2026 09:14:43 +0200 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The check did not notice the missing _json_decode, _mktemp and _url_replace helpers, for two reasons: - it only matched a _name followed by a space, so calls at the end of a command substitution or pipe like "$(_mktemp)" or "| _json_decode)" were never seen - it filtered whole lines, so any line that also contains an assignment, like "_tmp_file=$(_mktemp)", was dropped Rewrite it in Perl to extract each _name in command position (line start, after ( ` | ; & ! or a shell keyword, not followed by '='), skipping arithmetic like "$((_cnt - 1))", and report the ones defined neither in proxmox-acme nor in the calling plugin. Checked against the tree before the respective fixes, this reports dns_active24.sh: _json_decode, dns_oci.sh and dns_transip.sh: _mktemp, and dns_yc.sh: _url_replace. The false positives of the old check are gone, so the expected list shrinks to dns_aws.sh calling _error, which upstream acme.sh does not define either. Signed-off-by: Mathias Bartmann --- src/test/check-missing-functions | 59 ++++++++++++++++++++++++----- src/test/missing-functions.expected | 8 +--- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/test/check-missing-functions b/src/test/check-missing-functions index dfc32d3..adb93cd 100755 --- a/src/test/check-missing-functions +++ b/src/test/check-missing-functions @@ -1,14 +1,53 @@ -#!/bin/sh +#!/usr/bin/perl -set -e +use strict; +use warnings; -# functions already in src/proxmox-acme -PRESENT=$(awk 'BEGIN{ORS="\\W|";} /^_/{ gsub(/\(\) {/, ""); print $0}' \ - ../proxmox-acme | sed -r 's/\|$//') +# Print every _helper a dnsapi plugin calls that is defined neither in +# src/proxmox-acme nor in the plugin itself. -# functions defined in all plugins -LOCAL=$(awk 'BEGIN{ORS="\\W|";} /^_/{ gsub(/\(\) {/, ""); print $0}' \ - ../acme.sh/dnsapi/dns*.sh | sed -r 's/\|$//') +my $shim_path = '../proxmox-acme'; +my $dnsapi_path = '../acme.sh/dnsapi'; -grep -P '(?) { + $functions->{$1} = 1 if $line =~ /^\s*(_[A-Za-z0-9_]+)\s*\(\)/; + } + close($fh); + + return $functions; +} + +# a _word in command position: at line start, after ( ` | ; & ! or a shell +# keyword, and not followed by '=' (an assignment) - this also covers calls +# inside command substitutions like "$(_mktemp)" and pipes like "| _dbase64", +# but not variables in arithmetic like "$((_cnt - 1))" +my $call_re = qr/ + (?: ^ | (?) { + next if $line =~ /^\s*#/; + while ($line =~ /$call_re/g) { + my $function = $1; + next if $shim_functions->{$function} || $plugin_functions->{$function}; + print "$plugin: $function\n" if !$reported->{$function}++; + } + } + close($fh); +} diff --git a/src/test/missing-functions.expected b/src/test/missing-functions.expected index b338a58..c8f8240 100644 --- a/src/test/missing-functions.expected +++ b/src/test/missing-functions.expected @@ -1,7 +1 @@ -../acme.sh/dnsapi/dns_artfiles.sh: response="$(printf -- '%s' "$response" | sed '/_acme-challenge "'"$txtValue"'"/d')" -../acme.sh/dnsapi/dns_aws.sh: _error "invalid domain" -../acme.sh/dnsapi/dns_cpanel.sh: for _domain in $_domains; do -../acme.sh/dnsapi/dns_cyon.sh: printf "%s" "${_dns_entries}" | while read -r _hash _identifier; do -../acme.sh/dnsapi/dns_mythic_beasts.sh: export _H1 _H2 -../acme.sh/dnsapi/dns_openstack.sh: for _rec in $_records; do -../acme.sh/dnsapi/dns_selectel.sh: for _one_id in $_record_id; do +../acme.sh/dnsapi/dns_aws.sh: _error -- 2.55.0