[GRASS-dev] do not get debug messages in 63-cvs

Hello list!

For some time the debug messages in grass63-cvs are no longer working for me.

`g.gisenv set=DEBUG=5` seems to do its job as `g.gisenv DEBUG` returns "5" but no debug messages are printed when I call a module.

I tried a `make distclean`, even a complete new install of the whole source tree, but the problem is still there.
`./configure` and `make` run without errors...

It works fine in grass6.2.0-RC3 on the same machine, configured and compiled the same way.

Any ideas where the problem lies or what I did wrong?

Thank you,
Florian

--
Florian Kindl
Institute of Geography
University of Innsbruck

Hi,

see http://grass.itc.it/pipermail/grass-dev/2006-October/026644.html

Best, Martin

2006/11/4, Florian Kindl <Florian.Kindl@uibk.ac.at>:

Hello list!

For some time the debug messages in grass63-cvs are no longer working for
me.

`g.gisenv set=DEBUG=5` seems to do its job as `g.gisenv DEBUG` returns
"5" but no debug messages are printed when I call a module.

I tried a `make distclean`, even a complete new install of the whole
source tree, but the problem is still there.
`./configure` and `make` run without errors...

It works fine in grass6.2.0-RC3 on the same machine, configured and
compiled the same way.

Any ideas where the problem lies or what I did wrong?

Thank you,
Florian

--
Florian Kindl
Institute of Geography
University of Innsbruck

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Florian Kindl wrote:

For some time the debug messages in grass63-cvs are no longer working
for me.

`g.gisenv set=DEBUG=5` seems to do its job as `g.gisenv DEBUG` returns
"5" but no debug messages are printed when I call a module.

I tried a `make distclean`, even a complete new install of the whole
source tree, but the problem is still there.
`./configure` and `make` run without errors...

It works fine in grass6.2.0-RC3 on the same machine, configured and
compiled the same way.

Any ideas where the problem lies or what I did wrong?

I have the same trouble. I don't know why it happens. It works fine for
me in 6.2.

Hamish

Hi all,

it seems that the problem is calling G_getl2() function [grass63] in
lib/gis/env.c

diff grass62-> grass63

--- env.c 2006-11-05 10:18:28.000000000 +0100
+++ /usr/src/gis/grass6-6.2/lib/gis/env.c 2006-02-09
04:08:56.000000000 +0100
@@ -111,7 +111,7 @@

     if ((fd = open_env ("r", loc)))
     {
- while (G_getl2 (buf, sizeof buf, fd))
+ while (G_getl (buf, sizeof buf, fd))
        {
            for (name = value = buf; *value; value++)
                if (*value == ':')
[snip]

G_getl2() call G_debug() before reading DEBUG value, in the result
static variable grass_debug_level in lib/gis/debug.c is set to 0.

Best, Martin

2006/11/5, Hamish <hamish_nospam@yahoo.com>:

Florian Kindl wrote:
>
> For some time the debug messages in grass63-cvs are no longer working
> for me.
>
> `g.gisenv set=DEBUG=5` seems to do its job as `g.gisenv DEBUG` returns
> "5" but no debug messages are printed when I call a module.
>
> I tried a `make distclean`, even a complete new install of the whole
> source tree, but the problem is still there.
> `./configure` and `make` run without errors...
>
> It works fine in grass6.2.0-RC3 on the same machine, configured and
> compiled the same way.
>
> Any ideas where the problem lies or what I did wrong?

I have the same trouble. I don't know why it happens. It works fine for
me in 6.2.

Hamish

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

On Sun, 5 Nov 2006, Martin Landa wrote:

Hi all,

it seems that the problem is calling G_getl2() function [grass63] in
lib/gis/env.c

[snip]

G_getl2() call G_debug() before reading DEBUG value, in the result
static variable grass_debug_level in lib/gis/debug.c is set to 0.

Thank you, Martin!

I don't know how to repair G_getl2() properly, but commenting out the G_debug() statement in lib/gis/getl.c (veeeery dirty, I know...) fixes it for the moment...

thanks,
-Flo.

--
Florian Kindl
Institute of Geography
University of Innsbruck

Hi Florian,

I am also not sure, is this patch enough to fix it?

Best, Martin

2006/11/5, Florian Kindl <Florian.Kindl@uibk.ac.at>:

On Sun, 5 Nov 2006, Martin Landa wrote:

> Hi all,
>
> it seems that the problem is calling G_getl2() function [grass63] in
> lib/gis/env.c
>
> [snip]
>
> G_getl2() call G_debug() before reading DEBUG value, in the result
> static variable grass_debug_level in lib/gis/debug.c is set to 0.
>

Thank you, Martin!

I don't know how to repair G_getl2() properly, but commenting out the
G_debug() statement in lib/gis/getl.c (veeeery dirty, I know...) fixes it
for the moment...

thanks,
-Flo.

--
Florian Kindl
Institute of Geography
University of Innsbruck

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

getl.c.diff (476 Bytes)

Hi,

2006/11/5, Florian Kindl <Florian.Kindl@uibk.ac.at>:

On Sun, 5 Nov 2006, Martin Landa wrote:

> I am also not sure, is this patch enough to fix it?
> - G_debug ( 4, "G_getl2: ->%s<-", buf );
> + if (G__getenv ("DEBUG"))
> + G_debug ( 4, "G_getl2: ->%s<-", buf );
>

here, it works ...

yes, I meant -- when you do not set up DEBUG variable and call
G_getl2() function no debug message (inside the function) will be
printed. It is not nice solution.

Cheers, Martin

--
Florian Kindl
Institute of Geography
University of Innsbruck

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Dear developers,

2006/11/6, Martin Landa <landa.martin@gmail.com>:

[snip]

> > I am also not sure, is this patch enough to fix it?
> > - G_debug ( 4, "G_getl2: ->%s<-", buf );
> > + if (G__getenv ("DEBUG"))
> > + G_debug ( 4, "G_getl2: ->%s<-", buf );
> >
>
> here, it works ...

yes, I meant -- when you do not set up DEBUG variable and call
G_getl2() function no debug message (inside the function) will be
printed. It is not nice solution.

I would like to kindly ask you -- is it good enough for committing to
CVS? [no objections or feedback ~= can be commited;-).

Debug messages are still broken in grass63.

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

> > it seems that the problem is calling G_getl2() function [grass63]
> > in lib/gis/env.c
> >
> > [snip]
> >
> > G_getl2() call G_debug() before reading DEBUG value, in the result
> > static variable grass_debug_level in lib/gis/debug.c is set to 0.
> >
>
> Thank you, Martin!
>
> I don't know how to repair G_getl2() properly, but commenting out
> the G_debug() statement in lib/gis/getl.c (veeeery dirty, I know...)
> fixes it for the moment...

Ah I see,

the fn that reads .grassrc6 (lib/gis/env.c) is now calling G_getl2(),
and G_getl2() calls G_debug(), which needs a value from .grassrc6.

Do we have to worry about .grassrc6 getting DOS newlines in it?
(user shouldn't be copying that between systems and should not be
editing it)
-> back to using G_getl()

Does G_getl2() really need to call G_debug? I don't think so, the module
that calls it can add G_debug(5, "input line=", buff); if they want
that info.

--> I suggest removing G_debug() from G_getl2() altogether.

Martin's patch fixes this case, but we would need to always audit env.c
and everything it calls, and everything those calls call, to check it
doesn't have any g.gisenv reqs.. :frowning:

Index: lib/gis/getl.c

RCS file: /home/grass/grassrepository/grass6/lib/gis/getl.c,v
retrieving revision 2.4
diff -u -r2.4 getl.c
--- lib/gis/getl.c 9 Feb 2006 03:08:56 -0000 2.4
+++ lib/gis/getl.c 5 Nov 2006 10:18:48 -0000
@@ -82,7 +82,8 @@
     }
     buf[i] = '\0';

- G_debug ( 4, "G_getl2: ->%s<-", buf );
+ if (G__getenv ("DEBUG"))
+ G_debug ( 4, "G_getl2: ->%s<-", buf );

     return ret;
}

Hamish

Hi all,

2006/11/7, Martin Landa <landa.martin@gmail.com>:

[snip]

> > > I am also not sure, is this patch enough to fix it?
> > > - G_debug ( 4, "G_getl2: ->%s<-", buf );
> > > + if (G__getenv ("DEBUG"))
> > > + G_debug ( 4, "G_getl2: ->%s<-", buf );
> > >
> >
> > here, it works ...
>
> yes, I meant -- when you do not set up DEBUG variable and call
> G_getl2() function no debug message (inside the function) will be
> printed. It is not nice solution.

I would like to kindly ask you -- is it good enough for committing to
CVS? [no objections or feedback ~= can be commited;-).

Debug messages are still broken in grass63.

commited to CVS...

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

2006/11/10, Hamish <hamish_nospam@yahoo.com>:

[snip]

Ah I see,

the fn that reads .grassrc6 (lib/gis/env.c) is now calling G_getl2(),
and G_getl2() calls G_debug(), which needs a value from .grassrc6.

Do we have to worry about .grassrc6 getting DOS newlines in it?
(user shouldn't be copying that between systems and should not be
editing it)
-> back to using G_getl()

not sure, on the other hand it is always better to take care about
various newlines...

Does G_getl2() really need to call G_debug? I don't think so, the module
that calls it can add G_debug(5, "input line=", buff); if they want
that info.

--> I suggest removing G_debug() from G_getl2() altogether.

That's the issue (for me), is there any reason why G_getl2() calls
G_debug() [G_getl() does not call G_debug()]. These two functions
(i.e. G_getl() and G_getl2()) are very similar (the second one only
cares about various newlines). So we should remove G_debug() calling
from G_getl2() or similarly to add G_debug () to G_getl().

From simple point of view I also suggest *removing* G_debug() from G_getl2().

Martin

Martin's patch fixes this case, but we would need to always audit env.c
and everything it calls, and everything those calls call, to check it
doesn't have any g.gisenv reqs.. :frowning:

Index: lib/gis/getl.c

RCS file: /home/grass/grassrepository/grass6/lib/gis/getl.c,v
retrieving revision 2.4
diff -u -r2.4 getl.c
--- lib/gis/getl.c 9 Feb 2006 03:08:56 -0000 2.4
+++ lib/gis/getl.c 5 Nov 2006 10:18:48 -0000
@@ -82,7 +82,8 @@
     }
     buf[i] = '\0';

- G_debug ( 4, "G_getl2: ->%s<-", buf );
+ if (G__getenv ("DEBUG"))
+ G_debug ( 4, "G_getl2: ->%s<-", buf );

     return ret;
}

Hamish

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin Landa wrote:

> > > > I am also not sure, is this patch enough to fix it?
> > > > - G_debug ( 4, "G_getl2: ->%s<-", buf );
> > > > + if (G__getenv ("DEBUG"))
> > > > + G_debug ( 4, "G_getl2: ->%s<-", buf );
> > > >
> > >
> > > here, it works ...
> >
> > yes, I meant -- when you do not set up DEBUG variable and call
> > G_getl2() function no debug message (inside the function) will be
> > printed. It is not nice solution.
>
> I would like to kindly ask you -- is it good enough for committing
> to CVS? [no objections or feedback ~= can be commited;-).
>
> Debug messages are still broken in grass63.

commited to CVS...

Thank you very much for finding and fixing this Martin. After thinking
about it some more I came to the conclusion that G_debug() doesn't
belong in a low-level fn like G_getl2() at all, so I've removed it. It
is the module's choice to spit out a debug message with the result if
wanted. And solving the problem by adding more G_* calls might lead to
the same flavour of bug happening again (in fact G__getenv() calls
read_env() which calls G_getl2() - more circles!).

Also, G_getl2() is used in loops to read huge files, so any chance to
make it simpler (& thus faster) should be taken.

regards,
Hamish