Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation violation using the gclip tool on Fedora #27

Open
CmdrNorthpaw opened this issue Apr 28, 2022 · 8 comments
Open

Segmentation violation using the gclip tool on Fedora #27

CmdrNorthpaw opened this issue Apr 28, 2022 · 8 comments

Comments

@CmdrNorthpaw
Copy link

I have been using clipboard to build a small personal application as a replacement for xclip. The first time I built and tested the application, it threw this error:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime.throw({0x4bc05d?, 0x1?})
        /usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:802 +0x3a9

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4996f0, 0xc00006fde8)
        /usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc00006fdc0 sp=0xc00006fd88 pc=0x40521c
golang.design/x/clipboard._Cfunc_clipboard_test()
        _cgo_gotypes.go:93 +0x48 fp=0xc00006fde8 sp=0xc00006fdc0 pc=0x498028
golang.design/x/clipboard.initialize()
        /home/$USER/.go/pkg/mod/golang.design/x/[email protected]/clipboard_linux.go:60 +0x1d fp=0xc00006fe30 sp=0xc00006fde8 pc=0x49829d
golang.design/x/clipboard.Init(...)
        /home/$USER/.go/pkg/mod/golang.design/x/[email protected]/clipboard.go:102
main.init.0()
        /home/$USER/.go/pkg/mod/golang.design/x/[email protected]/cmd/gclip/main.go:47 +0x1a fp=0xc00006fe50 sp=0xc00006fe30 pc=0x49903a
runtime.doInit(0x546a00)
        /usr/local/go/src/runtime/proc.go:6222 +0x126 fp=0xc00006ff80 sp=0xc00006fe50 pc=0x4429e6
runtime.main()
        /usr/local/go/src/runtime/proc.go:233 +0x1d3 fp=0xc00006ffe0 sp=0xc00006ff80 pc=0x435a93
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00006ffe8 sp=0xc00006ffe0 pc=0x45ebc1

I thought it was an issue with my code, but the gclip reference tool throws the same error, so I must assume that the issue lies with the clipboard library. My /etc/os-release file (unsure if this helps):

VERSION="35 (KDE Plasma)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (KDE Plasma)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="KDE Plasma"
VARIANT_ID=kde```
@changkun
Copy link
Member

Thanks for the report. Unfortunately, we do not have a fedora system to test this issue. We would have to rely on the community to tackle this issue.

Contributions are welcome.

@changkun changkun added help wanted Extra attention is needed NeedsInvestigation labels Apr 28, 2022
@changkun changkun changed the title Segmentation violation using the gclip tool Segmentation violation using the gclip tool on Fedora Apr 30, 2022
@evilsocket
Copy link

this might depend by two things, either P_XOpenDisplay is NULL but doesn't get checked before being used here, or the $DISPLAY environment variable is not set (if the argument of XOpenDisplay is NULL as in this case, $DISPLAY is used instead).

@evilsocket
Copy link

evilsocket commented Sep 10, 2022

Just did a quick test and if the function pointer is correctly initialized, it shouldn't crash even if $DISPLAY is not set ... so there's a good chance that this SIGSEGV is caused by the function pointer being NULL (also hinted by that addr=0x0 pc=0x0). I suggest to check for those pointers in the initX11 function and return 1 only if they are all set. Also what's the point of looping 42 times? :D

image

@zangarmarsh
Copy link

zangarmarsh commented Sep 20, 2022

@changkun I confirm this bug is not specifically related to Fedora.

@changkun
Copy link
Member

@zangarmarsh Thanks for confirming the issue. Could you maybe share more details on how to reproduce the issue? More specifically, which environment, in which steps that you did?

@zangarmarsh
Copy link

@changkun It occurs in Ubuntu X11. I also tried in wayland and it works correctly.

@changkun
Copy link
Member

changkun commented Nov 2, 2022

@zangarmarsh Is the problem occurring on the latest commit?

@zangarmarsh
Copy link

@changkun I updated it to version 0.6.3 and it works! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants