[GRASS5] [bug #3362] (grass) r.proj works ONLY when source and target mapset names are identical

Morten Hulden morten at untamo.net
Wed Jun 22 18:02:59 EDT 2005


Glynn Clements wrote:
> Request Tracker wrote:
> 
> 
>>this bug's URL: http://intevation.de/rt/webrt?serial_num=3362
> 
> 
>>Subject: r.proj works ONLY when source and target mapset names are identical
> 
> 
>>mkdir: cannot create directory `/home/grassdata/caves_65/topo/.tmp': No such file or directory
>>
>>ERROR: can't make mapset element .tmp/quercus.biol.uni.wroc.pl
>>       (/home/grassdata/caves_65/topo/.tmp)
>>
>>It is trying to create a .tmp in a non-existant mapset! Like if it
>>couldn't read that the source mapset is PERMANENT. Somehow the
>>source and target mapset names get mixed.
> 
> 
> This is a very good reason not to use G_tempfile() for normal
> temporary files.
> 
> There is no guarantee that the user can create files or directories
> within the source location.
> 

So, not a r.proj specific problem then. A lot of modules may suffer from 
using G_tempfile().

r.proj is not calling G_tempfile() directly. In the case mentioned above 
suspects are datum.c, get_datum_name.c, get_ell_name.c or some other 
function from /lib/gis files.

What is the correct fix? To rewrite G_tempfile()?

----------------
find . -type f -name "*\.c" -exec grep -H G_tempfile {} \;
./display/d.ask/main.c:    tempfile = G_tempfile();
./display/d.barscale/mouse.c:   char *panel = G_tempfile();
./display/d.histogram/get_stats.c:    tempfile = G_tempfile();
./display/d.profile/Range.c:temp_fname = G_tempfile();
./display/d.rast.edit/mk_tmp_file.c:    tempfile = G_tempfile();
./display/d.text/main.c:        wind_file_name = G_tempfile();
./display/d.text.freetype/main.c:               tmpfile = G_tempfile();
./display/d.what.vect/what.c:   panell = G_tempfile();
./general/g.setproj/get_stp.c:  Tmp_file1 = G_tempfile();
./general/g.setproj/get_stp.c:  Tmp_file2 = G_tempfile();
./general/g.setproj/get_stp.c:  Tmp_file1 = G_tempfile();
./general/g.setproj/get_stp.c:  Tmp_file2 = G_tempfile();
./imagery/i.ask/popup.c:    tempfile1 = G_tempfile();
./imagery/i.ask/popup.c:    tempfile2 = G_tempfile();
./imagery/i.class/main.c:  tempfile = G_tempfile();
./imagery/i.find/main.c:    tempfile = G_tempfile();
./imagery/i.ortho.photo/libes/ls_cameras.c:     tempfile = G_tempfile();
./imagery/i.ortho.photo/libes/ls_elev.c:        tempfile = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    tempfile1 = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    tempfile2 = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    tempfile3 = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    cell_list = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    vect_list = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    group_list = G_tempfile();
./imagery/i.ortho.photo/photo.2image/main.c:    digit_points = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    tempfile1 = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    tempfile2 = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    tempfile_dot = 
G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    cell_list = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    vect_list = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    group_list = G_tempfile();
./imagery/i.ortho.photo/photo.2target/main.c:    digit_points = 
G_tempfile();
./imagery/i.ortho.photo/photo.rectify/write.c:        temp_name = 
G_tempfile();
./imagery/i.pca/main.c:  strcpy(temp, G_tempfile());
./imagery/i.points/main.c:    tempfile1 = G_tempfile();
./imagery/i.points/main.c:    tempfile2 = G_tempfile();
./imagery/i.points/main.c:    cell_list = G_tempfile();
./imagery/i.points/main.c:    vect_list = G_tempfile();
./imagery/i.points/main.c:    group_list = G_tempfile();
./imagery/i.points/main.c:    digit_points = G_tempfile();
./imagery/i.points/main.c:    digit_results = G_tempfile();
./imagery/i.rectify/write.c:        temp_name = G_tempfile();
./imagery/i.vpoints/main.c:    tempfile1 = G_tempfile();
./imagery/i.vpoints/main.c:    tempfile2 = G_tempfile();
./imagery/i.vpoints/main.c:    cell_list = G_tempfile();
./imagery/i.vpoints/main.c:    vect_list = G_tempfile();
./imagery/i.vpoints/main.c:    group_list = G_tempfile();
./imagery/i.vpoints/main.c:    digit_points = G_tempfile();
./imagery/i.vpoints/main.c:    digit_results = G_tempfile();
./lib/display/popup.c:    panel = G_tempfile() ;
./lib/g3d/g3dcache.c:  map->cacheFileName = G_tempfile ();
./lib/g3d/g3dopen.c:  map->tempName = G_tempfile ();
./lib/gis/asprintf.c:    if ((fn = G_tempfile())) {
./lib/gis/datum.c:        Tmp_file = G_tempfile ();
./lib/gis/get_datum_name.c:            Tmp_file = G_tempfile ();
./lib/gis/get_ell_name.c:        Tmp_file = G_tempfile ();
./lib/gis/get_projname.c:        Tmp_file = G_tempfile ();
./lib/gis/opencell.c:    tempname = G_tempfile ();
./lib/gis/opencell.c:    tempname = G_tempfile ();
./lib/gis/put_title.c:    tempfile = G_tempfile();
./lib/gis/tempfile.c: * G_tempfile()
./lib/gis/tempfile.c: * as a temporary file within the module. 
Successive calls to G_tempfile() will
./lib/gis/tempfile.c: * all temporary files created by G_tempfile() that 
have been left behind by
./lib/gis/tempfile.c:char *G_tempfile(void)
./lib/imagery/ls_groups.c:      tempfile = G_tempfile();
./lib/imagery/ls_groups.c:      tempfile = G_tempfile();
./lib/proj/datum.c:        Tmp_file = G_tempfile ();
./lib/vector/Vlib/map.c:    tmp = G_tempfile();
./ps/ps.map/comment.c:  PS.commentfile = G_tempfile();
./ps/ps.map/main.c:    ps_mask_file = G_tempfile();
./ps/ps.map/r_plt.c:    PS.plfile = G_tempfile();
./ps/ps.map/r_text.c:   labels.other = G_tempfile();
./ps/ps.map/session.c:  sessionfile = G_tempfile();
./raster/r.average/main.c:    tempfile1 = G_tempfile();
./raster/r.average/main.c:    tempfile2 = G_tempfile();
./raster/r.coin/main.c:    dumpname = G_tempfile () ;
./raster/r.coin/main.c:    statname = G_tempfile () ;
./raster/r.cost/main.c: in_file = G_tempfile();
./raster/r.cost/main.c: out_file = G_tempfile();
./raster/r.digit/main.c:    polyfile = G_tempfile();
./raster/r.drain/main.c:   tempfile1 = G_tempfile();
./raster/r.drain/main.c:   tempfile2 = G_tempfile();
./raster/r.fill.dir/main.c:   tempfile1 = G_tempfile();
./raster/r.fill.dir/main.c:   tempfile2 = G_tempfile();
./raster/r.fill.dir/main.c:   tempfile3 = G_tempfile();
./raster/r.flow/io.c:       ds.sfd = 
open_segment_file(tmp_name(G_tempfile()), ds, TEMP);
./raster/r.in.arc/main.c:               Tmp_file = G_tempfile ();
./raster/r.in.ascii/main.c:     temp = G_tempfile();
./raster/r.in.ascii/main.c:             Tmp_file = G_tempfile();
./raster/r.kappa/stats.c:  stats_file = G_tempfile();
./raster/r.le/r.le.setup/setup.c:  tempfile = G_tempfile();
./raster/r.los/main.c:  in_name = G_tempfile();
./raster/r.los/main.c:  out_name = G_tempfile();
./raster/r.los/main.c:          patt_name = G_tempfile();
./raster/r.mfilter/perform.c: 
close(creat(tmp1=G_tempfile(),0666));
./raster/r.mfilter/perform.c: 
close(creat(tmp2=G_tempfile(),0666));
./raster/r.out.mpeg/main.c:     yfiles[cnt] = G_tempfile();
./raster/r.out.mpeg/main.c:    mpfilename = G_tempfile();
./raster/r.out.mpeg/main.c:    mpfilename = G_tempfile();
./raster/r.out.mpeg/main.c:    tfile = G_tempfile();
./raster/r.report/stats.c:      stats_file = G_tempfile();
./raster/r.resamp.rst/main.c:    Tmp_file_z = G_tempfile ();
./raster/r.resamp.rst/main.c:    Tmp_file_dx = G_tempfile ();
./raster/r.resamp.rst/main.c:    Tmp_file_dy = G_tempfile ();
./raster/r.resamp.rst/main.c:    Tmp_file_xx = G_tempfile ();
./raster/r.resamp.rst/main.c:    Tmp_file_yy = G_tempfile ();
./raster/r.resamp.rst/main.c:    Tmp_file_xy = G_tempfile ();
./raster/r.statistics/o_average.c:    tempfile1 = G_tempfile();
./raster/r.statistics/o_average.c:    tempfile2 = G_tempfile();
./raster/r.statistics/o_distrib.c:    tempfile1 = G_tempfile();
./raster/r.statistics/o_distrib.c:    tempfile2 = G_tempfile();
./raster/r.statistics/o_sum.c:    tempfile1 = G_tempfile();
./raster/r.statistics/o_sum.c:    tempfile2 = G_tempfile();
./raster/r.surf.contour/bseg_open.c:    filename = G_tempfile ();
./raster/r.surf.contour/cseg_open.c:    filename = G_tempfile ();
./raster/r.thin/io.c:   work_file_name = G_tempfile();
./raster/r.watershed/seg/bseg_open.c:   filename = G_tempfile ();
./raster/r.watershed/seg/cseg_open.c:   filename = G_tempfile ();
./raster/r.watershed/seg/dseg_open.c:   filename = G_tempfile ();
./raster/r.watershed/seg/sseg_open.c:   filename = G_tempfile ();
./raster/wildfire/r.spreadpath/main.c:  in_row_file = G_tempfile();
./raster/wildfire/r.spreadpath/main.c:  in_col_file = G_tempfile();
./raster/wildfire/r.spreadpath/main.c:  out_file = G_tempfile();
./raster/r.support/modhead/check_un.c:        tempfile = G_tempfile();
./vector/v.in.ascii/in.c:           tmp = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_z = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_dx = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_dy = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_xx = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_yy = G_tempfile();
./vector/v.surf.rst/main.c:     Tmp_file_xy = G_tempfile();
./vector/v.vol.rst/main.c:      Tmp_file_cell = G_tempfile ();
./vector/v.vol.rst/main.c:      Tmp_file_z = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_dx = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_dy = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_dz = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_xx = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_yy = G_tempfile ();
./vector/v.vol.rst/main.c:        Tmp_file_xy = G_tempfile ();
./visualization/xganim/main.c:    tfile = G_tempfile();






More information about the grass-dev mailing list