Closed dankegel closed 1 year ago
Given the invalid command
let x/x
bash rightfully complains:
$ let x/x bash: let: x/x: division by 0 (error token is "x")
but gosh panics:
$ go run cmd/gosh/main.go $ let x/x panic: runtime error: integer divide by zero goroutine 1 [running]: mvdan.cc/sh/v3/expand.binArit(0x111540?, 0x589de0?, 0xc000122f28?) /home/dank/src/sh/expand/arith.go:173 +0x245 mvdan.cc/sh/v3/expand.Arithm(0x0?, {0x589840?, 0xc000078480?}) /home/dank/src/sh/expand/arith.go:95 +0x353 ...
This happens in v3.0.0 and master. I didn't try any tags older than v3.0.0. Tested with go 1.18.1.
Thanks, this does look like a bug. Happy to accept a patch with a test.
Given the invalid command
bash rightfully complains:
but gosh panics:
This happens in v3.0.0 and master. I didn't try any tags older than v3.0.0. Tested with go 1.18.1.