Opened 15 years ago

Closed 15 years ago

#887 closed defect (fixed)

db.describe fails if $GISBASE contains a space

Reported by: hamish Owned by: grass-dev@…
Priority: normal Milestone: 6.5.0
Component: Database Version: svn-releasebranch64
Keywords: spaces Cc:
CPU: x86-64 Platform: Linux

Description

Hi,

If I move "dist.x86_64-unknown-linux-gnu/" to "dist.x86_64-unknown-linux gnu/" (and edit ./bin.$ARCH/grass65), db.describe fails:

g.copy roads,roads2
db.describe roads2

D2/5: dbDbmscap(): opendir [/usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux gnu/driver/db/]
D2/5: dbDbmscap(): opendir [/usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux gnu/driver/db/]

sh: /usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux: No such file or directory
dbmi: Protocol error
ERROR: Unable to start driver <dbf>

near EOF of lib/db/dbmi_client/start.c:

  execl("/bin/sh", "sh", "-c", startup, NULL);

The startup string is set correctly; I guess execl() wants to see quotes in the string itself?

n.b. all programs in $GISBASE/driver/db/ are ELF binaries, so is sh really needed at all? why not just run them directly?

Hamish

ps- building GRASS in a dir with spaces seems impossible because Autoconf2.13 expansion code does not always quote $srcdir. (unless we run a second sed script after autoconf2.13 to run around the resulting configure file and quote variables as needed* -- but not all variables, e.g. $pwd can expand to "pwd -W".

Attachments (1)

start.diff (405 bytes ) - added by neteler 15 years ago.
dbmi start change

Download all attachments as: .zip

Change History (5)

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

Replying to hamish:

near EOF of lib/db/dbmi_client/start.c:

  execl("/bin/sh", "sh", "-c", startup, NULL);

The startup string is set correctly; I guess execl() wants to see quotes in the string itself?

execl() doesn't care; it's "sh" which wants the quotes.

n.b. all programs in $GISBASE/driver/db/ are ELF binaries, so is sh really needed at all? why not just run them directly?

Why not, indeed ;) IOW:

-  execl("/bin/sh", "sh", "-c", startup, NULL);
+  execl(startup, startup, NULL);

Hmm. The __MINGW32 version uses _spawnl(). I'm not sure whether this is an issue. The documentation says that arguments must be quoted, but I don't think that applies to the program.

Actually ... maybe we should just replace the bulk of db_start_driver() with G_spawn_ex(). Redirection (including to/from pipes) should work on Windows now.

ps- building GRASS in a dir with spaces seems impossible because Autoconf2.13 expansion code does not always quote $srcdir.

Forbidding spaces at compile time isn't a problem, and is probably inevitable. FWIW, I just use "/c/progra~1/..." for packages (e.g. !GnuWin32) which are installed there (although apparently it's possible to disable generation of 8.3 filenames).

by neteler, 15 years ago

Attachment: start.diff added

dbmi start change

comment:2 by neteler, 15 years ago

Is the attached change a 6.4 candidate?

Markus

PS: The spaces-in-path at compile time is discussed in #682

in reply to:  2 comment:3 by glynn, 15 years ago

Replying to neteler:

Is the attached change a 6.4 candidate?

I think so.

comment:4 by neteler, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in r41132 (6.4). In 6.5 and 7 it was already done.

Note: See TracTickets for help on using tickets.