rules_proto icon indicating copy to clipboard operation
rules_proto copied to clipboard

Gencopy panic

Open pcj opened this issue 2 years ago • 1 comments

on v2_prerelease branch:

        for f in info.outputs:
            print("checking info", f.path)
            dsts.append(f.short_path)
            path = f.short_path.split(ctx.attr.original_label_name + "_")[0]
            file = f.short_path[f.short_path.rfind("/") + 1:]

            # srcs.append(path + file)
            srcs.append(f.basename)
            # srcs.append(ctx.label.package + "/" + f.basename)

        config.packageConfigs.append(
            struct(
                targetLabel = str(info.label),
                # targetPackage = info.label.package,
                generatedFiles = dsts,
                # sourceFiles = srcs,
            ),
        )
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.runPkg(0xc0001282a0, 0xc00012e0f0, 0x10f9485, 0xc000128120)
	external/build_stack_rules_proto/cmd/gencopy/gencopy.go:170 +0x4af
main.run(0xc0001282a0, 0x3a, 0xc0001282a0)
	external/build_stack_rules_proto/cmd/gencopy/gencopy.go:192 +0x70
main.main()
	external/build_stack_rules_proto/cmd/gencopy/gencopy.go:235 +0x145

pcj avatar Oct 21 '21 21:10 pcj

If the srcs and dsts are unbalanced, program will panic

pcj avatar Jan 29 '22 00:01 pcj