Skip to content

Instantly share code, notes, and snippets.

@jmroot
Created February 26, 2025 11:01
Show Gist options
  • Select an option

  • Save jmroot/5c445ee40d45399b9edddcbf1fa307f4 to your computer and use it in GitHub Desktop.

Select an option

Save jmroot/5c445ee40d45399b9edddcbf1fa307f4 to your computer and use it in GitHub Desktop.
tcl-tls crash reproducer
#!/usr/bin/env port-tclsh
lappend auto_path {*}[glob -nocomplain -types d /opt/local/lib/tcltls*]
package require json
package require http
package require tls
set builds_url https://ports.macports.org/api/v1/builds/
::http::config -accept application/json
::http::register https 443 ::tls::socket
set now [clock seconds]
set portname [lindex $::argv 0]
foreach builder {14_arm64 14_x86_64} {
set token [::http::geturl ${builds_url}?[::http::formatQuery port_name $portname builder_name__name $builder status "failed install-port"] -keepalive 1]
if {[::http::status $token] eq "ok" && [::http::ncode $token] == 200} {
set jsondata [::http::data $token]
} else {
puts stderr "Error: query for $builder returned: [::http::error $token]"
::http::cleanup $token
continue
}
::http::cleanup $token
set builds_dict [::json::json2dict $jsondata]
if {[dict get $builds_dict count] >= 1} {
set timestamp [dict get [lindex [dict get $builds_dict results] 0] time_start]
puts "Last failed build for $portname on $builder was at $timestamp"
set timestamp_seconds [clock scan $timestamp -format {%Y-%m-%dT%H:%M:%S%Z}]
puts "and that was [expr {($now - $timestamp_seconds) / 86400}] days ago"
} else {
puts "Builds of $portname on $builder succeeded or failed in dependencies."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment