[GRASS-dev] [bug #4757] (grass) lib/gis/done_msg.c fails

this bug's URL: http://intevation.de/rt/webrt?serial_num=4757
-------------------------------------------------------------------------

Subject: lib/gis/done_msg.c fails

grass obtained from: CVS
grass binary for platform: Compiled from Sources

Hi,

both getlogin() and G_whoami() fail in lib/gis/done_msg.c.
It is not clear to me why these functions are needed at all.

Proposal: simplify the function to:

#include <grass/gis.h>
#include <grass/glocale.h>

int G_done_msg(char *msg)
{
        G_message(_("%s complete. %s\n"), G_program_name(), msg);
        return 0;
}

Markus

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4757
-------------------------------------------------------------------------

Subject: lib/gis/done_msg.c fails

grass obtained from: CVS
grass binary for platform: Compiled from Sources

Hi,

both getlogin() and G_whoami() fail in lib/gis/done_msg.c.
It is not clear to me why these functions are needed at all.

I suspect that it's to handle the situation where you start a job in
the background, log out, someone else logs in, your background job
completes and writes the completion message to the terminal.

This doesn't actually work on Linux, but I can't find any
documentation which addresses this situation. There isn't any
fundamental reason why a process which has a descriptor for the
terminal can't continue to use the terminal after you've logged out.

The code in G_done_msg() checks whether the user running the process
(as determined by G_whoami()) is the same as the user who is listed in
the utmp file as being logged in on the terminal.

IMHO, getting rid of that check is unlikely to have any adverse
consequences in real use.

--
Glynn Clements <glynn@gclements.plus.com>

On Wed, Jun 28, 2006 at 06:12:07PM +0100, Glynn Clements wrote:

Request Tracker wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=4757
> -------------------------------------------------------------------------
>
> Subject: lib/gis/done_msg.c fails
>
> grass obtained from: CVS
> grass binary for platform: Compiled from Sources
>
> Hi,
>
> both getlogin() and G_whoami() fail in lib/gis/done_msg.c.
> It is not clear to me why these functions are needed at all.

I suspect that it's to handle the situation where you start a job in
the background, log out, someone else logs in, your background job
completes and writes the completion message to the terminal.

This doesn't actually work on Linux, but I can't find any
documentation which addresses this situation. There isn't any
fundamental reason why a process which has a descriptor for the
terminal can't continue to use the terminal after you've logged out.

The code in G_done_msg() checks whether the user running the process
(as determined by G_whoami()) is the same as the user who is listed in
the utmp file as being logged in on the terminal.

IMHO, getting rid of that check is unlikely to have any adverse
consequences in real use.

Glynn,

not sure if I interprete your opinion correctly:
Approval for the proposed minimization of lib/gis/done_msg.c?

thanks
  Markus

Markus Neteler wrote:

> > this bug's URL: http://intevation.de/rt/webrt?serial_num=4757
> > -------------------------------------------------------------------------
> >
> > Subject: lib/gis/done_msg.c fails
> >
> > grass obtained from: CVS
> > grass binary for platform: Compiled from Sources
> >
> > Hi,
> >
> > both getlogin() and G_whoami() fail in lib/gis/done_msg.c.
> > It is not clear to me why these functions are needed at all.
>
> I suspect that it's to handle the situation where you start a job in
> the background, log out, someone else logs in, your background job
> completes and writes the completion message to the terminal.
>
> This doesn't actually work on Linux, but I can't find any
> documentation which addresses this situation. There isn't any
> fundamental reason why a process which has a descriptor for the
> terminal can't continue to use the terminal after you've logged out.
>
> The code in G_done_msg() checks whether the user running the process
> (as determined by G_whoami()) is the same as the user who is listed in
> the utmp file as being logged in on the terminal.
>
> IMHO, getting rid of that check is unlikely to have any adverse
> consequences in real use.

not sure if I interprete your opinion correctly:
Approval for the proposed minimization of lib/gis/done_msg.c?

Yes.

--
Glynn Clements <glynn@gclements.plus.com>