[GRASS-dev] g.mlist problem

I just updated from the cvs and compiled.

I tried the new fast g.mlist and got very weird results. Running g.mlist rast returned mapnames like…

elevation.10mnrstrct.areasn

… instead of

elevation.10m

Anyone have an idea what’s going on?

I’m on a MacBook Pro OS X.

Michael


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 18.09.2007 09:56, Michael Barton wrote:

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

It seems there is a missing \ before the n somewhere in the code, since
\ + n => \n = new line. Or then your compiler doesn't handle "\n" properly.

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

There is a cascade from the g.mlist problem reported below.

With g.mlist broken, the new TcTk animation module AND the selection control for wxPython GRASS GUI are also broken. Both are using g.mlist until g.list can be updated to optionally provide a flat list of GIS elements.

It looks like g.mlist is returning parts of g.list’s multicolumn format, separated by “n” instead of “\n” (new line).

Michael

On 9/17/07 11:56 PM, “Michael Barton” michael.barton@asu.edu wrote:

I just updated from the cvs and compiled.

I tried the new fast g.mlist and got very weird results. Running g.mlist rast returned mapnames like…

elevation.10mnrstrct.areasn

… instead of

elevation.10m

Anyone have an idea what’s going on?

I’m on a MacBook Pro OS X.

Michael


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

I've compiled GRASS numerous times without issue (including g.mlist), so I
don't understand what is going on here.

Michael

On 9/18/07 12:01 AM, "Wolf Bergenheim" <wolf+grass@bergenheim.net> wrote:

On 18.09.2007 09:56, Michael Barton wrote:

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

It seems there is a missing \ before the n somewhere in the code, since
\ + n => \n = new line. Or then your compiler doesn't handle "\n" properly.

--Wolf

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

There is a cascade from the g.mlist problem reported below.

With g.mlist broken, the new TcTk animation module AND the selection control for wxPython GRASS GUI are also broken. Both are using g.mlist until g.list can be updated to optionally provide a flat list of GIS elements.

It looks like g.mlist is returning parts of g.list’s multicolumn format, separated by “n” instead of “\n” (new line).

Michael

On 9/17/07 11:56 PM, “Michael Barton” michael.barton@asu.edu wrote:

I just updated from the cvs and compiled.

I tried the new fast g.mlist and got very weird results. Running g.mlist rast returned mapnames like…

elevation.10mnrstrct.areasn

… instead of

elevation.10m

Anyone have an idea what’s going on?

I’m on a MacBook Pro OS X.

Michael


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Wolf,

I just checked the 'binary' version against the source version of g.mlist.
Both are identical.

There must be something problematic in the new code. Has anyone else had
this problem?

Has this been tried on a Mac? I don't know what difference that would make,
but maybe something... I do know there there are some differences in Mac OS
X awk and Linux awk. I don't know about sed and bash.

Michael

On 9/18/07 12:01 AM, "Wolf Bergenheim" <wolf+grass@bergenheim.net> wrote:

On 18.09.2007 09:56, Michael Barton wrote:

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

It seems there is a missing \ before the n somewhere in the code, since
\ + n => \n = new line. Or then your compiler doesn't handle "\n" properly.

--Wolf

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Mon, Sep 17, 2007 at 11:56:02PM -0700, Michael Barton wrote:

   I just updated from the cvs and compiled.

   I tried the new fast g.mlist and got very weird results. Running g.mlist
   rast returned mapnames like...

   elevation.10mnrstrct.areasn

   ... instead of

   elevation.10m

   Anyone have an idea what's going on?

   I'm on a MacBook Pro OS X.

Please post you command (note that g.mlist is a script, nothing to compile):

GRASS 6.3.cvs (spearfish60):~ > g.mlist type=rast
myfields
aspect
bugsites
density
elevation.10m
elevation.dem
...

... works just fine. What do you exactly do?

Markus

------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------

On Tue, Sep 18, 2007 at 12:15:18AM -0700, Michael Barton wrote:

Wolf,

I just checked the 'binary' version against the source version of g.mlist.
Both are identical.

There must be something problematic in the new code. Has anyone else had
this problem?

Has this been tried on a Mac? I don't know what difference that would make,
but maybe something... I do know there there are some differences in Mac OS
X awk and Linux awk. I don't know about sed and bash.

Could you put

unset LC_ALL
LC_NUMERIC=C
export LC_NUMERIC

somewhere after the parser part to see if that helps (I don't
think so since you'll use US locale)
?

Markus

------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------

Michael Barton wrote:

I just updated from the cvs and compiled.

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

Anyone have an idea what's going on?

I'm on a MacBook Pro OS X.

Michael

Michael,

I ran make distclean and updated cvs this morning on Ubuntu 7.04, and no
problems here:

g.mlist pattern=*bathy*
olex_bathy
olex_bathy_fill
olex_bathy_fill_shade
olex_bathy_fill_shade_comb

Do the errors persist after make distclean on your system?

~ Eric.

--
View this message in context: http://www.nabble.com/g.mlist-problem-tf4472121.html#a12756785
Sent from the Grass - Dev mailing list archive at Nabble.com.

Michael,

No problem here on iMac intel, I did update from cvs yesterday (make distclean + make bindist + install).
GRASS 6.3.cvs (Projecte):~ > g.mlist pattern=geol
geol821.bluenvisual_mdt10n
geol821.greennvisualmdt2.5Kn
geol821.rednvisualmdt2Kn
geol8215x5.bluenvisualmdt4Kn
geol8215x5.greennwalkNIan
geol8215x5.rednwatershedn
geol8215x5nvisualmdt3Kn
geol821nvisual_mdtn

On Sep 18, 2007, at 3:15 PM, Eric Patton wrote:

Michael Barton wrote:

I just updated from the cvs and compiled.

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like…

elevation.10mnrstrct.areasn

… instead of

elevation.10m

Anyone have an idea what’s going on?

I’m on a MacBook Pro OS X.

Michael

Michael,

I ran make distclean and updated cvs this morning on Ubuntu 7.04, and no
problems here:

g.mlist pattern=bathy
olex_bathy
olex_bathy_fill
olex_bathy_fill_shade
olex_bathy_fill_shade_comb

Do the errors persist after make distclean on your system?

~ Eric.


View this message in context: http://www.nabble.com/g.mlist-problem-tf4472121.html#a12756785
Sent from the Grass - Dev mailing list archive at Nabble.com.


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

Same happens for me (OSX). I walked thru the script commands manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded in the
      pattern space. You can't, however, use a literal newline character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
  | grep -v '^-\+$' \
  | grep -v "files available" \
  | grep -vi "mapset" \
  | sed 's/ */\
/g' \
  | grep -v '^$' \
  | grep "$search" \
  | sort \
  | sed -e "s/$/$MAPSET/"

On Sep 18, 2007, at 2:15 AM, Michael Barton wrote:

Wolf,

I just checked the 'binary' version against the source version of g.mlist.
Both are identical.

There must be something problematic in the new code. Has anyone else had
this problem?

Has this been tried on a Mac? I don't know what difference that would make,
but maybe something... I do know there there are some differences in Mac OS
X awk and Linux awk. I don't know about sed and bash.

Michael

On 9/18/07 12:01 AM, "Wolf Bergenheim" <wolf+grass@bergenheim.net> wrote:

On 18.09.2007 09:56, Michael Barton wrote:

I tried the new fast g.mlist and got very weird results. Running g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

It seems there is a missing \ before the n somewhere in the code, since
\ + n => \n = new line. Or then your compiler doesn't handle "\n" properly.

--Wolf

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

William,

I'm very glad you've identified the problem. But I worry whether this
solution is portable across platforms.

Michael

On 9/18/07 6:47 AM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

Same happens for me (OSX). I walked thru the script commands
manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded in the
      pattern space. You can't, however, use a literal newline
character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
| grep -v '^-\+$' \
| grep -v "files available" \
| grep -vi "mapset" \
| sed 's/ */\
/g' \
| grep -v '^$' \
| grep "$search" \
| sort \
| sed -e "s/$/$MAPSET/"

On Sep 18, 2007, at 2:15 AM, Michael Barton wrote:

Wolf,

I just checked the 'binary' version against the source version of
g.mlist.
Both are identical.

There must be something problematic in the new code. Has anyone
else had
this problem?

Has this been tried on a Mac? I don't know what difference that
would make,
but maybe something... I do know there there are some differences
in Mac OS
X awk and Linux awk. I don't know about sed and bash.

Michael

On 9/18/07 12:01 AM, "Wolf Bergenheim" <wolf+grass@bergenheim.net>
wrote:

On 18.09.2007 09:56, Michael Barton wrote:

I tried the new fast g.mlist and got very weird results. Running
g.mlist
rast returned mapnames like...

elevation.10mnrstrct.areasn

... instead of

elevation.10m

It seems there is a missing \ before the n somewhere in the code,
since
\ + n => \n = new line. Or then your compiler doesn't handle "\n"
properly.

--Wolf

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

It should be. I checked the Gnu sed docs online, and they also say that you must use \ + real newline in the replacement string. I wonder why \n works for other platforms?

On Sep 18, 2007, at 10:04 AM, Michael Barton wrote:

William,

I'm very glad you've identified the problem. But I worry whether this
solution is portable across platforms.

Michael

On 9/18/07 6:47 AM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

Same happens for me (OSX). I walked thru the script commands
manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded in the
      pattern space. You can't, however, use a literal newline
character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
| grep -v '^-\+$' \
| grep -v "files available" \
| grep -vi "mapset" \
| sed 's/ */\
/g' \
| grep -v '^$' \
| grep "$search" \
| sort \
| sed -e "s/$/$MAPSET/"

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

All generalizations are dangerous, even this one.

Thanks again William.

Can others test on different platforms and let us know before I commit
something that breaks it for other people?

Michael

On 9/18/07 8:37 AM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

It should be. I checked the Gnu sed docs online, and they also say
that you must use \ + real newline in the replacement string. I
wonder why \n works for other platforms?

On Sep 18, 2007, at 10:04 AM, Michael Barton wrote:

William,

I'm very glad you've identified the problem. But I worry whether this
solution is portable across platforms.

Michael

On 9/18/07 6:47 AM, "William Kyngesburye" <woklist@kyngchaos.com>
wrote:

Same happens for me (OSX). I walked thru the script commands
manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded
in the
      pattern space. You can't, however, use a literal newline
character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
| grep -v '^-\+$' \
| grep -v "files available" \
| grep -vi "mapset" \
| sed 's/ */\
/g' \
| grep -v '^$' \
| grep "$search" \
| sort \
| sed -e "s/$/$MAPSET/"

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

All generalizations are dangerous, even this one.

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 18.09.2007 18:41, Michael Barton wrote:

Thanks again William.

Can others test on different platforms and let us know before I commit
something that breaks it for other people?

Works for me on Debian Linux.

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

William Kyngesburye wrote:

Same happens for me (OSX). I walked thru the script commands
manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded in the
      pattern space. You can't, however, use a literal newline character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
  | grep -v '^-\+$' \
  | grep -v "files available" \
  | grep -vi "mapset" \
  | sed 's/ */\
/g' \
  | grep -v '^$' \
  | grep "$search" \
  | sort \
  | sed -e "s/$/$MAPSET/"

Duh; I pointed this out in my first reply, then promptly forgot about
it:

http://grass.itc.it/pipermail/grass-dev/2007-September/032931.html

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

I just committed this fix to the cvs. It should work OK on all *nix
platforms now (I don't know about Windows and mysys).

Any chance that g.list can get an optional flat list output soon too? Just
map@mapset would be fine for scripting purposes.

Michael

On 9/18/07 12:23 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

William Kyngesburye wrote:

Same happens for me (OSX). I walked thru the script commands
manually, and it is indeed messing up on the first sed.

I see this in the sed man for Sed Regex info (OSX uses the BSD sed):

2. The escape sequence \n matches a newline character embedded in the
      pattern space. You can't, however, use a literal newline character
      in an address or in the substitute command.

Later, for the s/ function, it says:

A line can be split by substituting a newline character into it.
To specify a newline character in the replacement string, precede
it with a backslash.

Putting a real newline after the \ does the trick:

     g.list type=$type mapset=$mapset \
| grep -v '^-\+$' \
| grep -v "files available" \
| grep -vi "mapset" \
| sed 's/ */\
/g' \
| grep -v '^$' \
| grep "$search" \
| sort \
| sed -e "s/$/$MAPSET/"

Duh; I pointed this out in my first reply, then promptly forgot about
it:

http://grass.itc.it/pipermail/grass-dev/2007-September/032931.html

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton