You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a CLI application which uses uilive v0.0.4 to output execution statistics to the console at runtime. Everything was fine until I decided to use sniper as a key-value storage for my app. It turned out that one of the sniper package variables got corrupted (changes it's value from 12 to 0) after calling uilive.New(). Without calling uilive.New()sniper works perfectly fine.
I traced the issue down to the IOCTL syscall in getTermSize() function in terminal_size.go:
//...varszwindowSizefuncgetTermSize() (int, int) {
//...// `sniper` package variable is fine here_, _, _=syscall.Syscall(syscall.SYS_IOCTL,
out.Fd(), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz)))
// `sniper` package variable is reset to 0 returnint(sz.cols), int(sz.rows)
}Ubuntu20.04LTSx64
I am not sure what goes wrong exactly, but it looks like using an unsafe.Pointer to the sz package variable somehow messes up the memory contents. I can't say if any other package variables are affected.
I managed to fix the issue by simply moving package variables from terminal_size.go into the getTermSize() function body, making them local (and they kinda should be local, there are no usages of them outside of terminal_size.go):
Hi.
I am developing a CLI application which uses
uilive v0.0.4
to output execution statistics to the console at runtime. Everything was fine until I decided to use sniper as a key-value storage for my app. It turned out that one of thesniper
package variables got corrupted (changes it's value from12
to0
) after callinguilive.New()
. Without callinguilive.New()
sniper
works perfectly fine.I traced the issue down to the IOCTL syscall in
getTermSize()
function in terminal_size.go:I am not sure what goes wrong exactly, but it looks like using an
unsafe.Pointer
to thesz
package variable somehow messes up the memory contents. I can't say if any other package variables are affected.I managed to fix the issue by simply moving package variables from terminal_size.go into the
getTermSize()
function body, making them local (and they kinda should be local, there are no usages of them outside of terminal_size.go):What do you think? Please help me out.
Env specs:
PR: #39
P.S.: big thanks for the library, it's awesome :)
The text was updated successfully, but these errors were encountered: