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 fault error #26

Closed
RupankarGhosh opened this issue Nov 17, 2017 · 8 comments
Closed

Segmentation fault error #26

RupankarGhosh opened this issue Nov 17, 2017 · 8 comments

Comments

@RupankarGhosh
Copy link

RupankarGhosh commented Nov 17, 2017

Build it on Android with cli tools (Terminal). But when it runs it displays segmentation fault .Maybe Android doesn't have any X11 .Or I can't use the programme properly.

Cuping in Android

@dreua
Copy link
Member

dreua commented Nov 17, 2017

The code in this repository is not meant to compile or run on Android, sorry. See #19 for more on Android-Support.

@cnlohr
Copy link
Member

cnlohr commented Nov 17, 2017

uuuhh... the fact it's even getting that far is pretty wild. If you can get searchnet to work, that holds out hope and a different CNFG rawdraw frontend could be used!

@andrewssobral
Copy link

andrewssobral commented Feb 4, 2019

Thanks for this great tool!
but I had the same issue on my Ubuntu 18.04 desktop computer, see logs:

andrews@Precision-M4700:~/Projects$ git clone https://github.com/cnlohr/cnping.git
Cloning into 'cnping'...
remote: Enumerating objects: 4, done.                                                                                          
remote: Counting objects: 100% (4/4), done.                                                                                    
remote: Compressing objects: 100% (4/4), done.                                                                                 
remote: Total 439 (delta 0), reused 1 (delta 0), pack-reused 435                                                               
Receiving objects: 100% (439/439), 358.54 KiB | 0 bytes/s, done.
Resolving deltas: 100% (262/262), done.
Checking connectivity... done.
andrews@Precision-M4700:~/Projects$ cd cnping/                                                                                 
andrews@Precision-M4700:~/Projects/cnping$ ls
CNFGCocoaCGDriver.m  CNFGWinDriver.c  cnping.png        LICENSE               os_generic.c  README.md
CNFGFunctions.c      CNFGXDriver.c    error_handling.h  LICENSE.BSD-3-Clause  os_generic.h  resources.rc
CNFGFunctions.h      cnping.c         httping.c         LICENSE.MIT           ping.c        searchnet.c
CNFGRasterizer.h     cnping.exe       httping.h         Makefile              ping.h        uac.manifest
andrews@Precision-M4700:~/Projects/cnping$ sudo apt install libxinerama-dev libxext-dev libx11-dev build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
libx11-dev is already the newest version (2:1.6.3-1ubuntu2).
libx11-dev set to manually installed.
libxext-dev is already the newest version (2:1.3.3-1).
libxext-dev set to manually installed.
libxinerama-dev is already the newest version (2:1.1.3-1).
libxinerama-dev set to manually installed.
The following packages were automatically installed and are no longer required:
  freepats gstreamer1.0-plugins-bad-faad gstreamer1.0-plugins-bad-videoparsers libass5 libavresample-ffmpeg2 libbs2b0
  libchromaprint0 libdc1394-22 libdca0 libde265-0 libfaad2 libflite1 libfluidsynth1 libgstreamer-plugins-bad1.0-0
  libgtkglext1 libkate1 libmimic0 libmjpegutils-2.1-0 libmms0 libmpeg2encpp-2.1-0 libmplex2-2.1-0 libofa0 libopenal-data
  libopenal1 libsodium18 libsoundtouch1 libspandsp2 libsrtp0 libvo-aacenc0 libvo-amrwbenc0 libwildmidi-config libwildmidi1
  libzbar0 libzmq5
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
andrews@Precision-M4700:~/Projects/cnping$ make linuxinstall
cc  -g -Os -I/opt/X11/include -Wall   -c -o cnping.o cnping.c
cnping.c: In function ‘main’:                                                                                                  
cnping.c:640:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]                             
  runargv = argv;
          ^                                                                                                                    
cc  -g -Os -I/opt/X11/include -Wall   -c -o CNFGFunctions.o CNFGFunctions.c
cc  -g -Os -I/opt/X11/include -Wall   -c -o CNFGXDriver.o CNFGXDriver.c
cc  -g -Os -I/opt/X11/include -Wall   -c -o os_generic.o os_generic.c
cc  -g -Os -I/opt/X11/include -Wall   -c -o ping.o ping.c
cc  -g -Os -I/opt/X11/include -Wall   -c -o httping.o httping.c
gcc  -g -Os -I/opt/X11/include -Wall -o cnping cnping.o CNFGFunctions.o CNFGXDriver.o os_generic.o ping.o httping.o -lX11 -lm -lpthread -g -L/opt/X11/lib/ 
sudo rm -f /usr/local/bin/cnping
sudo cp cnping /usr/local/bin/
sudo setcap cap_net_raw+ep /usr/local/bin/cnping
andrews@Precision-M4700:~/Projects/cnping$ sudo cp cnping /usr/local/bin/
andrews@Precision-M4700:~/Projects/cnping$ sudo chmod +s /usr/local/bin/cnping
andrews@Precision-M4700:~/Projects/cnping$ cnping
Usage: cnping [host] [period] [extra size] [y-axis scaling] [window title]
   (-h) [host]                 -- domain, IP address of ping target for ICMP or http host, i.e. http://google.com
   (-p) [period]               -- period in seconds (optional), default 0.02 
   (-s) [extra size]           -- ping packet extra size (above 12), optional, default = 0 
   (-y) [const y-axis scaling] -- use a fixed scaling factor instead of auto scaling (optional)
   (-t) [window title]         -- the title of the window (optional)
andrews@Precision-M4700:~/Projects/cnping$ cnping http://google.com                                                            
Segmentation fault (core dumped)
andrews@Precision-M4700:~/Projects/cnping$

do you have any news on how to fix that? thanks in advance

@andrewssobral
Copy link

I found the issue, it occurs when I run cnping from an SSH session, but when I run it in the bash terminal from Ubuntu it works fine! Great work! thanks

@cnlohr
Copy link
Member

cnlohr commented Feb 4, 2019

Hmm... I haven't had any issues with ping http stuff. Can you run it in gdb for me and see where it crashes? Also may want to use debug.

(1) Change -Os to -O0 in Makefile
(2) execute gdb cnping
(3) type run http://google.com in gdb.
(4) Copy and paste output.

@dreua
Copy link
Member

dreua commented Feb 7, 2019

The issue has nothing to do with HTTP but I tried gdb anyway:

$ gdb cnping
GNU gdb (GDB) Fedora 8.1.1-4.fc28
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cnping...Reading symbols from /usr/lib/debug/usr/bin/cnping-0-20180813gitaa3c971.fc28.x86_64.debug...done.
done.
(gdb) run github.com
Starting program: /usr/bin/cnping github.com
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.27-37.fc28.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000404404 in CNFGSetup (
    WindowName=WindowName@entry=0x7ffde351e260 "github.com - cnping", 
    w=w@entry=320, h=h@entry=155) at CNFGXDriver.c:168
168		XGetWindowAttributes( CNFGDisplay, RootWindow(CNFGDisplay, 0), &CNFGWinAtt );
Missing separate debuginfos, use: dnf debuginfo-install libX11-1.6.5-7.fc28.x86_64 libXau-1.0.8-11.fc28.x86_64 libxcb-1.13-1.fc28.x86_64
(gdb) 

I think CNFGDisplay is null when using ssh without proper X-Forwarding. Most graphical applications fail in this environment. I'm working on a better error handling (warning instead of SEGFAULT).

@andrewssobral
Copy link

Hi @dreua , yes, the problem is exactly due to proper X-Forwaring on SSH. In my case, everything is working well now. thanks

@cnlohr
Copy link
Member

cnlohr commented Feb 7, 2019

Closing this issue though I am hoping @dreua gives feedback in the actual merge request. Thanks for the solution!

@cnlohr cnlohr closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants