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

"Redundant argument in printf" warning on Debug.pm line 98 with perl 5.32 #44

Closed
chrisridd opened this issue Sep 17, 2021 · 3 comments
Closed
Assignees

Comments

@chrisridd
Copy link
Contributor

chrisridd commented Sep 17, 2021

I also see this in perl5.28 and perl5.30, but I've not been following perl5 development closely enough to know when this changed or broke.

With -w and use warnings in effect and Convert::ASN1 version 0.31, calling:

Convert::ASN1::asn_dump(*STDOUT, $str);

where $str is a bunch of raw BER, results in an annoying warning every time line 98 is hit:

Redundant argument in printf at /opt/local/lib/perl5/vendor_perl/5.32/Convert/ASN1/Debug.pm line 98, <> line 1. 0000 1294: SEQUENCE {

I see the same (unsurprisingly) using Net::LDAP's debug(15) mode.

@timlegge
Copy link
Collaborator

timlegge commented Sep 18, 2021

diff --git a/lib/Convert/ASN1/Debug.pm b/lib/Convert/ASN1/Debug.pm
index 905600b..099189a 100644
--- a/lib/Convert/ASN1/Debug.pm
+++ b/lib/Convert/ASN1/Debug.pm
@@ -95,7 +95,7 @@ sub asn_dump {
     my $label = $type{sprintf("%02X",$tag & ~0x20)}
                || $type{sprintf("%02X",$tag & 0xC0)}
                || "[UNIVERSAL %d]";
-    printf $label, $tnum;
+    printf "%s: %d\n", $label, $tnum;
 
     if ($tag & ASN_CONSTRUCTOR) {
       print " {\n";

@timlegge timlegge self-assigned this Sep 18, 2021
@chrisridd
Copy link
Contributor Author

chrisridd commented Sep 20, 2021

You shouldn't include the "\n" in the format string, otherwise LGTM thanks @timlegge !

With the \n and a certificate as data you output:

0000 1294: SEQUENCE: 16
 {
0004   64:   SEQUENCE: 16
 {
0006    9:     OBJECT ID: 6
 = 1.2.840.113549.1.5.13
0011   51:     SEQUENCE: 16
 {
[...]

without the \n you output the "nicer" (at least for us ASN.1 fanboys):

0000 1294: SEQUENCE: 16 {
0004   64:   SEQUENCE: 16 {
0006    9:     OBJECT ID: 6 = 1.2.840.113549.1.5.13
0011   51:     SEQUENCE: 16 {
[...]

@timlegge
Copy link
Collaborator

timlegge commented Sep 20, 2021 via email

timlegge added a commit to timlegge/perl-Convert-ASN1 that referenced this issue Sep 21, 2021
  * examples/x509decode: parameters are optional for AlgorithmIdentifier when using [ec]dsa algorithms
  * t/19issue14.t: issue with warnings
  * Fixes gbarr#44 Redundant argument in printf warning
  * examples/x509decode: fix prototype error
  * examples/ldap: fix asn1_dump not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants