Discussion:
FVWM: Clarify rule for using quote symbols.
Oleksandr Gavenko
2014-01-09 22:45:51 UTC
Permalink
I use Fvwm Version: 1:2.6.5.ds-3 from Debian.


The only thing I found in "QUOTING" section in fvwm(1) that quoted characters
are spaces (when using single/double/back quotes).

I check quoting with Perl module:

my $module = new FVWM::Module(
Name => "XXX",
Mask => M_STRING,
Debug => 1,
);

sub xxx {
my ($module, $event) = @_;
my ($action, @args) = get_tokens($event->_text);
$module->send("1st arg: " . $action);
}

$module->addHandler(M_STRING, \&xxx);
$module->event_loop;

I test:

SendToModule XXX.pl XXX
[fvwm][Echo]:
Kbdd unknown action: XXX

SendToModule XXX.pl "XXX"
[fvwm][Echo]:
Kbdd unknown action: XXX

SendToModule XXX.pl "XXX YYY"
[fvwm][Echo]:
Kbdd unknown action: XXX YYY

SendToModule XXX.pl XXX YYY
[fvwm][Echo]:
Kbdd unknown action: XXX

# With TAB
SendToModule XXX.pl "XXX YYY"
[fvwm][Echo]:
Kbdd unknown action: XXX YYY

# With TAB
SendToModule XXX.pl XXX YYY
[fvwm][Echo]:
Kbdd unknown action: XXX

So TABs and SPACEs quoted by single/double/back-quote characters.

Exec uses same convention:

Exec xmessage "XXX"
SHOW: XXX
Exec xmessage '"XXX"'
SHOW: "XXX"
Exec xmessage XXX YYY
SHOW: XXX YYY
Exec xmessage "XXX YYY"
SHOW: XXX YYY

But:

Echo XXX
[fvwm][Echo]:
XXX

Echo "XXX"
[fvwm][Echo]:
"XXX"

Echo "XXX YYY"
[fvwm][Echo]:
"XXX YYY"

So seems that Echo is special form and don't follow traditional Fvwm quoting
convention... Is that true or this is a bug?
--
Best regards!
Dominik Vogt
2014-01-10 15:18:44 UTC
Permalink
Post by Oleksandr Gavenko
The only thing I found in "QUOTING" section in fvwm(1) that quoted characters
are spaces (when using single/double/back quotes).
[snip]
[snip]
Post by Oleksandr Gavenko
Echo "XXX YYY"
"XXX YYY"
So seems that Echo is special form and don't follow traditional
Fvwm quoting convention... Is that true or this is a bug?
I'd call it a glitch. Something that wasn't really indended, that
is surprising and doesn't do any harm. Note that if you use
variables with the Echo command, they get properly expanded (e.g.
$[w.x]) whether inside or outside quotes.

The reason for this is that the whole command line is parsed by
the general command line code in functions.c. This code expands
variables. Then the CMD_Echo function is called with the rest of
the command line as a string and just prints it.

All(?) other commands use the parsing library to split the passed
argument string into separate tokens. This library takes care of
stripping the quotes.

Actually, the command parsing code in fvwm lacks a real design;
every command does its own parsing, and there are probably many
more such glitches, especially in commands with complex syntax.
The way to deal with this glitch is to just ignore it; every other
command should handle quoting properly, and if not it's most
likely a bug.

Ciao

Dominik ^_^ ^_^
--
Dominik Vogt
Thomas Adam
2014-04-22 00:32:12 UTC
Permalink
Post by Dominik Vogt
Post by Oleksandr Gavenko
The only thing I found in "QUOTING" section in fvwm(1) that quoted characters
are spaces (when using single/double/back quotes).
[snip]
[snip]
Post by Oleksandr Gavenko
Echo "XXX YYY"
"XXX YYY"
So seems that Echo is special form and don't follow traditional
Fvwm quoting convention... Is that true or this is a bug?
I'd call it a glitch. Something that wasn't really indended, that
is surprising and doesn't do any harm. Note that if you use
variables with the Echo command, they get properly expanded (e.g.
$[w.x]) whether inside or outside quotes.
Yes. I most likely introduced this, with this commit:

"Fix Echo command displaying messages"

Oh well. I really don't care; it's a cosmetic thing as far as Echo is
concerned. As you say, Dominik, far too many commands to their own
processing. Someone should unify that. :) Add that to the pot of
other things to do.

-- Thomas Adam

Loading...