homeport / dyff

/ˈdʏf/ - diff tool for YAML files, and sometimes JSON
MIT License
1.3k stars 62 forks source link

Support Missing Blocks on Dyff #234

Open shaharr-ma opened 2 years ago

shaharr-ma commented 2 years ago

In case 2 Kubernetes manifests files are being compared but 1 file missing some block (I.E HorizontalPodAutoscaler), DYFF fails to execute with the below output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x137deae]

goroutine 1 [running]:
github.com/homeport/dyff/pkg/dyff.Report.ExcludeRegexp.func1(0x0)
        github.com/homeport/dyff/pkg/dyff/reports.go:94 +0x6e
github.com/homeport/dyff/pkg/dyff.Report.filter({{{0x7ffeefbffad4, 0x12}, {0x0, 0x0}, {0xc0000964c0, 0x2, 0x2}, {0xc0000982e0, 0x2, 0x2}}, ...}, ...)
        github.com/homeport/dyff/pkg/dyff/reports.go:16 +0x11c
github.com/homeport/dyff/pkg/dyff.Report.ExcludeRegexp({{{0x7ffeefbffad4, 0x12}, {0x0, 0x0}, {0xc0000964c0, 0x2, 0x2}, {0xc0000982e0, 0x2, 0x2}}, ...}, ...)
        github.com/homeport/dyff/pkg/dyff/reports.go:92 +0x1c5
github.com/homeport/dyff/internal/cmd.glob..func1(0x1732120, {0xc000115080, 0x16, 0x16})
        github.com/homeport/dyff/internal/cmd/between.go:107 +0x5de
github.com/spf13/cobra.(*Command).execute(0x1732120, {0xc000114f20, 0x16, 0x16})
        github.com/spf13/cobra@v1.4.0/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0x17328a0)
        github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.4.0/command.go:902
github.com/homeport/dyff/internal/cmd.Execute()
        github.com/homeport/dyff/internal/cmd/root.go:110 +0x9a
main.main()
        ./main.go:35 +0x2b
HeavyWombat commented 2 years ago

In case 2 Kubernetes manifests files are being compared but 1 file missing some block (I.E HorizontalPodAutoscaler), DYFF fails to execute with the below output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x137deae]

goroutine 1 [running]:
github.com/homeport/dyff/pkg/dyff.Report.ExcludeRegexp.func1(0x0)
        github.com/homeport/dyff/pkg/dyff/reports.go:94 +0x6e

Thanks for bringing it up. Do you have an example you can paste here? That makes it easier to setup a test case and write a fix.

shaharr-ma commented 2 years ago

Hi @HeavyWombat - in general it's the same issue as https://github.com/homeport/dyff/issues/232

shaharr-ma commented 2 years ago

Hi @HeavyWombat - is there any plan to fix this issue ?

HeavyWombat commented 2 years ago

To be honest, I am slowly working myself through by homeport backlog. This is on the list. The problem in #232 should be fixed with the latest release. Does that include your problem here as well?

shaharr-ma commented 2 years ago

@HeavyWombat #232 issue is a bit different, i'm referring to - https://github.com/homeport/dyff/blob/2e6f1c072605bfdcc007294bb026539e486e1a7a/pkg/dyff/core.go#L137