[GRASS-dev] White space in location path and compiling addons

Hi,

when I’m in location “/data/dir/GRASS Data/nc_smp/” and I try to install addon module using g.extension I get the following error:

$ g.extension extension=g.proj.all svnurl=http://svn.osgeo.org/grass/grass-addons/grass7
Fetching <g.proj.all> from GRASS-Addons SVN (be patient)…
Compiling…
/grass/src/include/Make/Rules.make:15: target /data/dir/GRASS' given more than once in the same rule. ... /grass/src/include/Make/HtmlRules.make:14: warning: overriding commands for target /data/dir/GRASS’
/grass/src/include/Make/Rules.make:16: warning: ignoring old
commands for target /data/dir/GRASS' ... make: *** No rule to make target %‘, needed by
`/data/dir/GRASS’. Stop.
ERROR: Compilation failed, sorry. Please check above error messages.

There is an ticket #1178 closed as wontfix for this but it is for GRASS 6 shell script and MS Windows, I’m on Linux with GRASS 7 Python script.

Since it is a problem with Makefile, I’m not sure if it is possible to fix. Does GNU make support paths with spaces?

Anyway, there might be better way to fix it. g.extension.py is using

TMPDIR = grass.tempdir()

to create the temporary directory in which it runs compilation

os.chdir(TMPDIR)

and uses this dir for make variables:

os.path.join(TMPDIR, name, ‘bin’)

make … ‘BIN=%s’ % dirs[‘bin’]

grass.script.core.tempdir()

uses

grass.script.core.tempfile(create=False)

which uses g.tempfile with -d flag.

Isn’t this just the misunderstanding of the purpose of g.tempfile which already occurred several times? Wouldn’t the use of tempfile.mkdtemp() from Python library just solve the whole issue?

  • TMPDIR = grass.tempdir()
  • TMPDIR = tempfile.mkdtemp()

Do you think that this is correct? If so, I can commit this one liner and hopefully test it in next days, but honestly, it seems so clear that I would be very surprised if there is some issue. What do you think?

Vaclav

[#1178] http://trac.osgeo.org/grass/ticket/1178

[g.extension] http://grass.osgeo.org/grass70/manuals/g.extension.html

[g.tempfile] http://grass.osgeo.org/grass70/manuals/g.tempfile.html
[mkdtemp] http://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp

PS: I don’t use spaces in file names. I discovered this issue by chance.

2014/1/8 Vaclav Petras <wenzeslaus@gmail.com>:
...

Since it is a problem with Makefile, I'm not sure if it is possible to fix.
Does GNU make support paths with spaces?

No. http://savannah.gnu.org/bugs/?712#comment2

In the light of g.extension probably it's time to review our options -
to not use standard make for extensions or to move away from GNU make
to some more modern solution (cmake anyone?).

Maris.