Subject: fvwm-menu-directory doesn't escape special chars

From: Tim Phipps <[email-masked]>
Date: Fri, 24 Aug 2001 11:41:22 +0100

Configuration Information [Automatically generated, do not change]:
uname output: SunOS silver 5.5.1 Generic_103640-35 sun4u sparc SUNW,Ultra-5_10
Compiler: gcc
Compilation CFLAGS: -g -O2
prefix: /u/phippst/sunos

FVWM Version:	2.4.1_beta1
FVWM_MODULEDIR:	/u/phippst/sunos/libexec/fvwm/2.4.1_beta1
FVWM_DATADIR:	/u/phippst/sunos/share/fvwm
FVWM_USERDIR:	/u/phippst/.fvwm

Description:
	fvwm-menu-directory produces syntax errors from fvwm when it tries
	to create a menu with a file that has two %'s in its name.
	It also doesn't handle & * " very well. @ and ^ in directory names
	needs fixing too but not in file names.

Repeat-By:

touch "1&amp" "1%perc" "1*star"
touch 'double"quote'
touch "2%perc%" "2&amp&" "2*star*"
mkdir "1^circ" "1@at" "2^circ^" "2@at@"
touch "1^circ/file" "1@at/file" "2^circ^/file" "2@at@/file"

Fix:

Replace & with && etc. ^ is difficult with submenus as some shells interpret
it as a |. It should be \ escaped by the time fvwm Exec's fvwm-menu-directory.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 25 Aug 2001 01:33:00 +0000

On 24 Aug 2001 11:41:22 +0100, Tim Phipps wrote:
> Replace & with && etc. ^ is difficult with submenus as some shells
> interpret it as a |. It should be \ escaped by the time fvwm Exec's
> fvwm-menu-directory.

Which unix shell interprets ^ in quotes specially?

I fixed the problems above and some more, except for ^ and @ in Popup
(they work in Menu with --reuse). I think it should be fixed in fvwm.

Currently when MissingSubmenuFunction is called the argument is not passed
correctly. Double ^^ and @@ are not converted to single ones as should be.
Also if Popup "my  name" contains spaces, 2 parameters are passed. The
whole name may be read in $*, but $* is not good for fvwm-menu-directory
(unlike $0 .. $9 if you use $* you should know how the function is called),
the best solution is to implement what the man page says:

              I.e. the name is passed  to  the  function  as  its
              first argument and can be referred to with "$0".

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 25 Aug 2001 11:29:43 +0000

> correctly. Double ^^ and @@ are not converted to single ones as should be.

Correction. This part is ok, my mistake. ^ and @ should only be escaped in
AddToMenu, not in DestroyMenu, Menu, ChangeMenuStyle.

Now, directories with ^ or @ work well for me.
Still I think this syntax is bad for several reasons:

  AddToMenu [email-masked]@^blue^

Compare with a syntax without escaping problems:

  AddToMenu StartMenu "Start" Title linux-menu.xpm SidePic blue SideColor

I also tried to make files and dirs with $ and \ work in the script.
This works ok, except for file names like $v or $$v. I am checking the
possibility that there is a bug of escaping special vars in + lines.
It is impossible to make it work with all shells since they escape $ and \
differently in strings, I only consider bash and company.
"ExecUseShell /bin/tcsh" currently does not work in very rare cases.

>               first argument and can be referred to with "$0".

This is still a problem.

Regards,
Mikhael.