[GRASS5] Re: 6.0.x CVS

> > I was thinking
> > mv grass51 grass6
> > ln -s grass6 grass51

Done now!
CVS access is reenabled.

I switched off grass51 in the viewcvs interface to avoid=20
showing the same module twice.=20
I hope links will also be corrected then, because they fail.

For fresh checkouts: Use module grass6 now.
For old checkouts: You can continue using grass51,
no need to do a complete recheck in at this time.

Thanks for the change. It works well.

We could experiment with scripts changing the CVS/Root file contents.

Find attached the script doing this job.

Usage:

1. Go to GRASS 6 CVS source code main directory, store the attached
    script there, then use 'find' to launch the script:

       cd grass6src_cvs/
       find . -name 'Repository' -exec sh change-repository.sh {} \;

2. After that, cleanup of Repository.tmp files

       find . -name 'Repository.tmp' -exec rm {} \;

3. Done. Continue working as before.

Cheers

Markus

(attachments)

change-repository.sh (475 Bytes)

On Sat, Feb 12, 2005 at 06:56:54PM +1300, Hamish wrote:

http://grass.itc.it/pipermail/grass-commit/2005-February/016839.html

- char buf[2000], colorstring[8]; /* RR:GG:BB */

re. string arrays- fyi

you usually need to leave room in a string array for a terminating null,

so if the space needed to be for "RR:GG:BB", you'd need to set
"char colorstring[9];", which would be addressable as colorstring[0] to
colorstring[8].

C lets you access colorstring[912334565] if you want.. but this usually
segfaults as (non)random memory access...

and

sprintf (colorstring, "%s", db_get_string(&valstr));

is a classic buffer overflow if valstr is longer than sizeof(colorstring).

Thanks for catching that. That are my personal problems with strings in C :slight_smile:

thus there is snprintf(), but IIRC that wasn't portable? so we have
G_asprintf(), which I'm not very familiar with.
shrug.

Hamish

I have cc'ed to the list. The experts may suggest.

Markus

On Sat, 12 Feb 2005, Markus Neteler wrote:

sprintf (colorstring, "%s", db_get_string(&valstr));

is a classic buffer overflow if valstr is longer than sizeof(colorstring).

Thanks for catching that. That are my personal problems with strings in C :slight_smile:

thus there is snprintf(), but IIRC that wasn't portable? so we have
G_asprintf(), which I'm not very familiar with.
shrug.

Declare as:
char *colorstring;

Then:
colorstring = G_store( db_get_string(&valstr) );

Note that:
G_asprintf( &colorstring, "%s", db_get_string(&valstr) );
would also work but no need to complicate things further than G_store() as you're just copying one string to another.

Then (after the last time you've used colorstring):
G_free(colorstring);

Should be freed if either G_store() or G_asprintf() have been used.

Hope this helps and is correct.

Paul