This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Problem setting up systemtap 1.6 client/server on Ubutu 11.10
- From: Josh Stone <jistone at redhat dot com>
- To: Alex Wolfson <alex dot wolfson at canonical dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 20 Oct 2011 23:18:57 -0700
- Subject: Re: Problem setting up systemtap 1.6 client/server on Ubutu 11.10
- References: <4EA07D2E.3070205@canonical.com> <4EA0847E.5070109@redhat.com>
For some reason, your mailer or the list server mangled your reply, but
picking out pieces...
Alex Wolfson wrote:
> Hi Josh,
>
> Thank you for the feedback.
>
> I found the place when stap-serverd is failing
> it is in stap-serverd.cxx
>
> static void
> initialize (int argc, char **argv) {
> .....
> string login = getlogin ();
> getlogin returns NULL
> |getlogin| is an unsafe and deprecated way of determining the logged-in
> user. It's probably trying to open a record of logged-in users, perhaps
> |utmp| or something. The correct way to determine the user you're
> running as (which might not be the same as the logged-in user, but is
> almost always better to use anyway) is |getpwuid(getuid())|
>
> So after I replaced
>
> string login = getlogin ();
>
> with
>
> struct passwd *pwd;
> pwd = getpwuid(getuid());
> string login = pwd->pw_name;
>
> I can now manualy run
>
> ./stap-serverd
>
> without std::logic_error
>
> Looks like this bug is specific ether to Ubuntu or my setup.
>
> I hope to find time to finish my script next week and provide a patch
> for getlogin and whatever else will show up.
> Probably replacing getlogin() call is a good idea anyway.
>
> Thanks,
>
> Alex
It looks like we did run into this bug, and Dave already fixed it:
https://bugzilla.redhat.com/show_bug.cgi?id=737095
commit 3845290458cd498e490078318ae5306911cb47a9
Author: Dave Brolley <brolley@redhat.com>
Date: Tue Sep 13 11:07:11 2011 -0400
RHBZ 737095: Unable to start a systemtap server
- Don't use getlogin to obtain user name because it can fail.
- Establish server log before issuing any messages.
- Failure of avahi to advertise is now only a warning. Avahi is not
always available and the server can still be used directly.
There are two other commits mentioned in the bug too, but this is the
one make a similar getlogin change as you propose.
HTH,
Josh