Skip to content

Commit 6334a4f

Browse files
authored
Merge pull request #82 from tianon/sharedtag-children
Add workaround for "bashbrew children" with SharedTags in FROM/--from=
2 parents ca308fd + ed66831 commit 6334a4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/bashbrew/cmd-children.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ func cmdChildren(c *cli.Context) error {
4141
continue
4242
}
4343

44+
// TODO this is buggy with respect to SharedTags, but it's really complicated to fix correctly (essentially, the shared tags become "owned" by one specific leg of the shared set, which is then hard to reconcile -- use "--arch-filter" if you want SharedTags to work [more] correctly [caveat Windows, where we can't know which leg to assign them to; perhaps full "--apply-constaints" there])
4445
tags := r.Tags(namespace, false, entry)
4546
for _, tag := range tags {
46-
canonical[tag] = tags[0]
47+
if _, ok := canonical[tag]; !ok { // again, see the note above -- this is a hack that makes it "work" in the common case of the Linux tags being listed first and those being the ones we're interested in (so they "own" the shared tags and don't get clobbered), and that's *mostly* safe because we enforce that any Windows image needs to be FROM an explicit Windows base/kernel version (not a shared tag) anyways, but it's still pretty hacky/sketchy and the algorithm here probably needs (yet another, maybe minor?) redesign 😭
48+
canonical[tag] = tags[0]
49+
}
4750
}
4851

4952
entryArches := []string{arch}

0 commit comments

Comments
 (0)