[GRASS-dev] Re: [GRASS-user] Build Grass62!

Hamish:

> "mkdir -p" isn't quoting the path

Glynn:

That looks like a bug in the Makefile(s); can you say which one(s)?

grass63$ grep -rI "mkdir -p" *
ChangeLog: * lib/vector/dglib/Makefile: mkdir -p
ChangeLog.bak: * lib/vector/dglib/Makefile: mkdir -p
Makefile:MAKE_DIR_CMD= mkdir -p -m 755
Makefile: @test -d $(GRASS_PDFDIR) || mkdir -p $(GRASS_PDFDIR)
Makefile: @test -d $(GRASS_PDFDIR) || mkdir -p $(GRASS_PDFDIR)
binaryInstall.src: mkdir -p $BINDIR
binaryInstall.src: mkdir -p $DESTDIR
debian/rules: #mkdir -p debian/tmp/usr/share/grass/bwidget
gem/reg_entries.c: sprintf ( str, "mkdir -p %s/etc/gm/Xtns ; cp -f ../entries-gisman2 %s/etc/gm/Xtns/%s.gem ; ",
include/Make/Grass.make.in: mkdir -p $(ARCH_BINDIR)
include/Make/Grass.make.in: mkdir -p $(ARCH_INCDIR)
include/Make/Grass.make.in: mkdir -p $(ARCH_LIBDIR)
include/Make/Grass.make.in: mkdir -p $(BIN)
include/Make/Grass.make.in: mkdir -p $(ETC)
include/Make/Grass.make.in: mkdir -p $(DRIVERDIR)
include/Make/Grass.make.in: mkdir -p $(DBDRIVERDIR)
include/Make/Grass.make.in: mkdir -p $(FONTDIR)
include/Make/Platform.make.in:MKDIR = mkdir -p
include/Make/Grass.make: mkdir -p $(ARCH_BINDIR)
include/Make/Grass.make: mkdir -p $(ARCH_INCDIR)
include/Make/Grass.make: mkdir -p $(ARCH_LIBDIR)
include/Make/Grass.make: mkdir -p $(BIN)
include/Make/Grass.make: mkdir -p $(ETC)
include/Make/Grass.make: mkdir -p $(DRIVERDIR)
include/Make/Grass.make: mkdir -p $(DBDRIVERDIR)
include/Make/Grass.make: mkdir -p $(FONTDIR)
include/Make/Platform.make:MKDIR = mkdir -p
lib/init/make_location_epsg.sh.in:mkdir -p $GISDBASE/$TEMPDIR/PERMANENT
rpm/fedora/grass_FC4.spec: mkdir -p %{buildroot}%{_libdir}/pkgconfig
rpm/fedora/gdal-ogr-grass-plugin.spec:mkdir -p ${AUTOLOAD}
scripts/r.in.wms/wms.request: mkdir -p "${GIS_OPT_FOLDER}"
scripts/v.db.addtable/v.db.addtable: mkdir -p ${GISDBASE}/${LOCATION_NAME}/${MAPSET}/dbf
tools/build_html_index.sh:mkdir -p $HTMLDIR/gem

Hamish

Hamish wrote:

Hamish:
> > "mkdir -p" isn't quoting the path
Glynn:
> That looks like a bug in the Makefile(s); can you say which one(s)?

[snip]

In retrospect, I don't see any point changing this. The issue isn't
just applicable to mkdir, but to all commands; the mkdir command which
is failing just happens to be the first command for the first target
(builddemolocation).

Unless we quote every single pathname variable in every Makefile
(which I don't consider to be feasible), trying to build from a
directory whose pathname contains shell metacharacters simply won't
work.

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

Glynn Clements wrote:

Hamish wrote:

> Hamish:
> > > "mkdir -p" isn't quoting the path
> Glynn:
> > That looks like a bug in the Makefile(s); can you say which
> > one(s)?

[snip]

In retrospect, I don't see any point changing this. The issue isn't
just applicable to mkdir, but to all commands; the mkdir command which
is failing just happens to be the first command for the first target
(builddemolocation).

Unless we quote every single pathname variable in every Makefile
(which I don't consider to be feasible), trying to build from a
directory whose pathname contains shell metacharacters simply won't
work.

The same applies for path names with spaces, correct? I'm not too
concerned about supporting [&,|,',`,!] in pathnames, but spaces in
pathnames are pretty common for Mac and (native) Windows.

If it does apply to spaces, it may take a while to complete the job, but
we can start and slowly move towards that goal... at minimum we can
establish a best practice for future work.

Hamish

Glynn Clements wrote:

Unless we quote every single pathname variable in every Makefile
(which I don't consider to be feasible),

the (module) Makefiles are all fairly similar, a sed/awk script could
process the bulk of them.

Hamish

Hamish wrote:

> > > > "mkdir -p" isn't quoting the path
> > Glynn:
> > > That looks like a bug in the Makefile(s); can you say which
> > > one(s)?
>
> [snip]
>
> In retrospect, I don't see any point changing this. The issue isn't
> just applicable to mkdir, but to all commands; the mkdir command which
> is failing just happens to be the first command for the first target
> (builddemolocation).
>
> Unless we quote every single pathname variable in every Makefile
> (which I don't consider to be feasible), trying to build from a
> directory whose pathname contains shell metacharacters simply won't
> work.

The same applies for path names with spaces, correct?

Correct.

I'm not too
concerned about supporting [&,|,',`,!] in pathnames, but spaces in
pathnames are pretty common for Mac and (native) Windows.

That isn't really an issue so long as people are building under Cygwin
or MSys/MinGW, as the build directory will probably be within the Unix
pseudo-filesystem.

If it does apply to spaces, it may take a while to complete the job, but
we can start and slowly move towards that goal... at minimum we can
establish a best practice for future work.

Personally, I consider "best practice" to be not cluttering up the
Makefiles with lots of quotes. Just take the same approach as every
other Unix project in existence, and require the build directory to
have a "sane" pathname.

Supporting spaces or other metacharacters in the pathname to the final
installation directory would be reasonable, and probably not much work
as it's only really relevant to the "install" target in the top-level
Makefile.

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