Opened 16 years ago

Last modified 9 years ago

#508 new defect

hardcoded /dev/null

Reported by: hamish Owned by: grass-dev@…
Priority: major Milestone: 6.4.6
Component: Default Version: 6.4.0 RCs
Keywords: wingrass, /dev/null, r.out.mpeg Cc:
CPU: x86-32 Platform: MSWindows XP

Description

Hi,

imagery/i.cluster/main.c
raster/r.out.mpeg/main.c
raster/r.topmodel/misc.c
lib/gis/opencell.c  G__open_cell_old()

all hardcode to /dev/null which doesn't exist on Windows.

perhaps

#ifdef __MINGW32__
#define NULLDEV "NUL:"
#else
#define NULLDEV "/dev/null"
#endif

or somesuch? (no idea)

d.ask and XDRIVER do too, but they don't work on MS Windows.

Hamish

Change History (9)

in reply to:  description comment:1 by glynn, 16 years ago

Replying to hamish:

perhaps

#ifdef __MINGW32__
#define NULLDEV "NUL:"
#else
#define NULLDEV "/dev/null"
#endif

or somesuch? (no idea)

See G_DEV_NULL in gis.h

comment:2 by hamish, 16 years ago

i.cluster, r.topmodel, and lib/gis/opencell.c updated in r36143 - r36148.

For grass 6 I am not really sure what to do with r.mapcalc from r.topmodel/misc.c. I can do

  G_putenv("GRASS_VERBOSE", "0");

but then how to undo that as soon as r.mapcalc is done? ie so you don't override user's verbosity setting for everything that happens afterwards in the module. on unix you could put "GRASS_VERBOSE=0 r.mapcalc ..." on the same line, dunno if that works for windows.

n.b. old >/dev/null didn't catch G_percent() as it is to stderr not stdout.

Also I am not sure how to fix r.out.mpeg (sends 2> /dev/null), so that one remains to be fixed.

Hamish

comment:3 by neteler, 14 years ago

The remaining /dev/null are

find . -name '*.c' | xargs grep '/dev/null'
./raster/r.out.mpeg/main.c:    if (256 == G_system("ppmtompeg 2> /dev/null"))
./raster/r.out.mpeg/main.c:    else if (256 == G_system("mpeg_encode 2> /dev/null"))
./raster/r.out.mpeg/main.c:     sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
./raster/r.out.mpeg/main.c:     sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
./raster/r.out.mpeg/main.c:         sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null",
./display/drivers/XDRIVER/Serve_Xevent.c:    open("/dev/null", O_RDONLY);
./display/drivers/XDRIVER/Serve_Xevent.c:    open("/dev/null", O_WRONLY);
./display/drivers/XDRIVER/Serve_Xevent.c:    open("/dev/null", O_WRONLY);
./display/d.ask/main.c: fd = popen("d.menu tcolor=red > /dev/null", "w");
./visualization/xganim/main.c:      sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg,

comment:4 by hamish, 14 years ago

as in comment:2 I'm not sure how to fix r.out.mpeg. XDRIVER and d.ask aren't an issue for WinGrass. I'm not sure if xganim could be made to work on WinGrass or not, but it's better replaced by the wxGUI animator version. (?)

So I'd be happy to close the bug as long as r.out.mpeg could get fixed.

Hamish

in reply to:  4 ; comment:5 by glynn, 14 years ago

Replying to hamish:

as in comment:2 I'm not sure how to fix r.out.mpeg.

G_system("ppmtompeg 2>" G_DEV_NULL);

A more significant issue is gee_wildfiles(), which does:

    sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null",
	    path, wildarg, tfile);

If you want a complete replacement, the 7.0 version of xganim uses G_spawn_ex() and g.mlist.

I'm not sure if xganim could be made to work on WinGrass or not, but it's better replaced by the wxGUI animator version. (?)

The 6.x xganim requires Motif and an X server, which is probably more trouble than it's worth. Also, on Windows and MacOSX you would need to either use Lesstif (which is still "beta" quality and barely maintained) or buy a commercial version of Motif; the OpenMotif licence is limited to open-source platforms.

comment:6 by hellik, 14 years ago

Milestone: 6.4.06.4.2

comment:7 by hamish, 12 years ago

Keywords: r.out.mpeg added
Milestone: 6.4.26.4.4

r.out.mpeg still needs fixing.

in reply to:  5 comment:8 by wenzeslaus, 11 years ago

Replying to glynn:

Replying to hamish:

I'm not sure if xganim could be made to work on WinGrass or not, but it's better replaced by the wxGUI animator version. (?)

The 6.x xganim requires Motif and an X server, which is probably more trouble than it's worth. Also, on Windows and MacOSX you would need to either use Lesstif (which is still "beta" quality and barely maintained) or buy a commercial version of Motif; the OpenMotif licence is limited to open-source platforms.

Just for the record, xganim was removed from GRASS 7 in favor of g.gui.animation.

For trunk, both egrep -Irn "NULLDEV" and egrep -Irn "/dev/null" return nothing for raster/r.out.mpeg.

comment:9 by neteler, 9 years ago

Milestone: 6.4.46.4.6
Note: See TracTickets for help on using tickets.