From aab2c27ba53aae0226d7909154d0cabc4429615f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 15 Sep 2023 16:08:44 -0400 Subject: sbolint: fix stupidity from ef85e9d (WTF was I smoking?) --- TODO | 1 + sbolint | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index d3f63b4..ff10c68 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ +TODO: fix format strings in warning messages *properly*. TODO: locale issues break the 'grep -P' in the info check. two things: (1) use a more reliable way to detect gz files, and (2) possibly force LANG and LC_* to "C". Or else en_US.UTF-8. diff --git a/sbolint b/sbolint index 454e16b..7799652 100755 --- a/sbolint +++ b/sbolint @@ -516,7 +516,7 @@ sub dequote { sub logmsg { my $severity = shift; my $format = shift; - print("$buildname: $severity: $format\n", @_); + printf("$buildname: $severity: $format\n", @_); } sub log_error { @@ -1057,7 +1057,7 @@ sub check_info { } if(!check_url($info{HOMEPAGE})) { - log_error("$file: HOMEPAGE=\"$info{HOMEPAGE}\" doesn't look like a valid URL (http, https, or ftp)"); + log_error("$file: HOMEPAGE=\"%s\" doesn't look like a valid URL (http, https, or ftp)", $info{HOMEPAGE}); } # use a HEAD request for homepage, even if downloading other files @@ -1099,7 +1099,7 @@ sub check_dl_and_md5 { for my $u (@dlurls) { if(!check_url($u)) { - log_error("$file: $dlkey URL '$u' doesn't look like a valid URL (http, https, or ftp)"); + log_error("%s: %s URL \"%s\" doesn't look like a valid URL (http, https, or ftp)", $file, $dlkey, $u); next; } @@ -1108,7 +1108,7 @@ sub check_dl_and_md5 { if($url_head) { curl_head_request($file, $u) || do { #warn '$u is '. $u; - log_warning("$file: $dlkey URL '$u' broken?"); + log_warning("%s: %s URL \"%s\" broken?", $file, $dlkey, $u); }; } elsif($url_download) { warn "$SELF: -d option not yet implemented\n"; @@ -1149,7 +1149,7 @@ sub curl_head_request { if(/^content-disposition:\s+attachment;\s+filename=["']?(.*?)["']?$/i) { #warn $1; if(defined($client_filename) && ($client_filename ne $1)) { - log_warning("$file: download filename varies based on content disposition: '$1' vs. '$client_filename'"); + log_warning("%s: download filename varies based on content disposition: '%s' vs. '%s'", $file, $1, $client_filename); } } } -- cgit v1.2.3