GNOME Bugzilla – Bug 106164
system-monitor fails to compile on solaris due to missing functions
Last modified: 2011-11-11 10:03:55 UTC
Compiling gnome-system-monitor under garnome (after porting libgtop to working status on Solaris), I get these errors. These system calls are not in Solaris. gcc -O2 -pipe -falign-functions=4 -fomit-frame-pointer -mfancy-math-387 -mcpu=pentiumpro -g -L/opt/garnome/lib -L/opt/local/lib -L/usr/openwin/lib -R/opt/garnome/lib -R/opt/local/lib -R/usr/openwin/lib -o gnome-system-monitor procman.o interface.o callbacks.o load-graph.o proctable.o prettytable.o util.o infoview.o procactions.o procdialogs.o memmaps.o favorites.o -threads -R/usr/openwin/lib -L/opt/garnome/lib -L/usr/openwin/lib -L/opt/garnome/lib -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lxml2 -lz -lgnomecanvas-2 -lgnome-2 -lart_lgpl_2 -lpangoft2-1.0 -lbonobo-2 -lgnomevfs-2 -lbonobo-activation -lgconf-2 -lORBit-2 -lnsl -lsocket -llinc -lgthread-2.0 -lgtop-2.0 -lgtop_sysdeps-2.0 -lgtop_common-2.0 -lwnck-1 -lstartup-notification-1 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lintl -liconv -liconv Undefined first referenced symbol in file getpt util.o asprintf util.o ld: fatal: Symbol referencing errors. No output written to gnome-system-monitor collect2: ld returned 1 exit status make[4]: *** [gnome-system-monitor] Error 1
Created attachment 14382 [details] [review] Patch to allow gnome-system-monitor to complete compilation on Solaris
The patch works (sparc solaris 8). Note that this is a dupe of bug 65011.
Cool! So does the root stuff work on Solaris? If you try to renice a process not owned by you (or kill), can you enter in the root password and have it work?
Guess some more debugging needs to be done. That part of the code doesn't seem to be working. I'll see what I can do.
I'm seeing a couple of issues: 1) GTK+ does not like applications to be setuid, so gnome-system-monitor won't run as root. This cascades onto the problem of opening the kernel (kvm_open). I'm not sure this is such a serious issue immediately. The real problem is the code I pinched to supplement asprintf, is failing on the test of the vsnprintf, and that may well be a solaris implementation issue. Basically, what happens in util.c is where it's trying to build the Xauthority environment variable and it never gets any further. Obviously, because they are environment variables, a working asprintf is really needed, otherwise, security problems are bound to happen. vsnprintf should be returning the length of the formatted string, and 0 as a size tells it's just supposed to return the size. Will have to address this to Sun.
Making progress. I found a fix to handle Solaris's broken C99 vsnprintf behavior. In the vasprintf routine, If I replace ret = vsnprintf(NULL, 0, format, ap); with char c; ret = vsnprintf(&c, 1, format, ap); vsnprintf returns the right length, and therefore the XAUTHORITY and ICEAUTHORITY variables can get set in the environment in the exec_su routine. The next problem is the format of the su command. From the parameters, it's looking for GNU su (specifically the -m flag), so I'm considering using an #ifdef to do this. However, the next problem is that the password prompt is coming out on the tty I started gnome-system-monitor from, instead of it getting it from the pty. This should glue all together, and I'm sure that it works on linux correctly. I just haven't figured out why it's not doing the right things on solaris.
*** Bug 65011 has been marked as a duplicate of this bug. ***
This patch never made it to the main branch? did it? I still don't see an implementation of getpt and asprintf in sysdeps/solaris.
And it hasn't made it into gnome-system-monitor-2.3.0 either. (See: http://bugzilla.gnome.org/show_bug.cgi?id=115486) I experience the same behaviour on SPARC/Solaris 7 w/ gcc-3.2.2.
Just FYI, I've gnome-system-monitor running on Solaris 7 w/ Gnome-2.2.2, and I can confirm the problem with the password prompt coming out on the tty, as the_h1ghlander@yahoo.com earlier has described, when launching gnome-system-monitor from a command line. It actually displays a popup window and asks for the password, after one has confirmed "End Process" in another popup window first. Once one has entered the "Root Password and pressed the "End Process" button the password popup window does not go away, but hangs. Instead the prompt "Password:" is displayed at the command line. Once I have supplied the correct password (at the command line) I receive kind of "login banner", i.e. "Sun Microsystems Inc. SunOS 5.7 Generic Month Year" and then "-sh: kill: bad signal" at the command line, and the hanged popup window resumes, i.e. is hidden (but WITHOUT KILLING the chosen process) [ Could there be some kind of PAM-issue here? ]. One more observation: When starting gnome-system-monitor in a terminal window, e.g. Xterm, etc, the following message is displayed in the terminal window, but gnome-system-manager continues to run (at least more or less as expected): "glibtop: kvm_open(): Permission denied" until it is stopped, and the following message is displayed: "glibtop: pid ##### received eof."
*** Bug 115486 has been marked as a duplicate of this bug. ***
Applied. Thanks highlander. THis should be available with gnome-system-monitor and libgtop 2.5.1.