Thank you! I haven't yet tried it with any currently existing (unaffected) versions, but it is already substantially more promising. I think that I have a few more changes, but I will look at submitting a PR once I have finished testing.
-a On Sun, Feb 4, 2024 at 11:13 PM Joshua Root <[email protected]> wrote: > On 5/2/2024 14:58, Austin Ziegler wrote: > > I think I have found a bug in the golang portgroup, and I think I have > > an idea on how to fix it, but I'm not sure how to test such a > modification. > > You'd make the change in your local copy of the ports tree and check > that a port affected by the bug now works correctly, and that some > existing ports still work correctly. > > > For those interested, it's in go._translate_package_id. If I have a > > package ID github.com/jmespath/go-jmespath/internal/testify > > <http://github.com/jmespath/go-jmespath/internal/testify>, the > > *subproject* is internal/testify, not internal. But the line `set > > subproject [lindex ${parts} 3]` will *only* grab `internal`. > > > > So this: > > > > ```tcl > > set parts [split ${package_id} /] > > > > set domain [lindex ${parts} 0] > > set author [lindex ${parts} 1] > > set project [lindex ${parts} 2] > > # possibly empty > > set subproject [lindex ${parts} 3] > > ``` > > > > Should probably be this: > > > > ```tcl > > set parts [split $package_id /] > > > > set domain [lindex $parts 0] > > set author [lindex $parts 1] > > set project [lindex $parts 2] > > # Join the remaining parts to get the full subproject path > > if {[llength $parts] > 3} { > > set subproject [join [lrange $parts 3 end] /] > > } else { > > set subproject "" > > } > > ``` > > This could be simplified further to something like: > > set parts [split $package_id /] > set remaining_parts [lassign $parts domain author project] > set subproject [join $remaining_parts /] > > - Josh > -- Austin Ziegler • [email protected] • [email protected] http://www.halostatue.ca/ • http://twitter.com/halostatue
