Ticket #125 (assigned defect)

Opened 1 year ago

Last modified 1 year ago

Cannot run a hook command containing metacharacters

Reported by: Deewiant Assigned to: Gregor (accepted)
Priority: major Milestone: 0.74
Component: DSSS Version:
Keywords: Cc:

Description

I need to run a couple of command line sed scripts, some of which contain semicolons, in the prebuild hook. I've split them over multiple lines for legibility, but in any case, DSSS interprets a semicolon within the sed pattern as a command delimiter.

This means that, for instance, prebuild += echo "foo;bar" is interpreted as two commands, echo "foo and bar", when it should be the single command echo "foo;bar".

The documentation doesn't mention any way of avoiding this: if it's possible, it should be documented, and if it isn't, it needs to be made possible.

Change History

08/25/07 11:44:46 changed by Deewiant

  • summary changed from Cannot run a hook command containing a semicolon to Cannot run a hook command containing metacharacters.

A dollar sign doesn't work either. It appears to get environment variables:

prebuild += echo foo$bar$baz;
prebuild += echo zot

The above runs echo foo$baz and echo zot. Since I have no "bar" environment variable the $bar evaluated to nothing. But I wanted echo foo$bar$baz, not echo foo<environment variable bar>$baz. It seems odd to me that the $baz wasn't eaten as well.

Some sort of escaping mechanism is needed. Since there don't seem to be many characters which need it, I suggest just doubling: $$ is equivalent to a $ and ;; is equivalent to a ;.

$$ seems to already work, but I'm not sure if that's intentional or a result of there not being a "" environment variable.

Wrapping the command in some sort of delimiters would work, but it's so common to use the quotation marks in the commands themselves that the delimiters would have to be something rarely used. Here-documents might be a good idea.

08/28/07 00:30:59 changed by Gregor

  • status changed from new to assigned.
  • version set to 0.74.

This is one of those head-slapping moments :) Assigning to 0.74.

08/28/07 00:32:08 changed by Gregor

  • version deleted.
  • milestone set to 0.74.

Whoops, marked wrong.