\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{fullpage}
\usepackage{html}
\newcommand{\path}[1]{\texttt{#1}}
\newcommand{\menu}[1]{\textit{#1}}
\newcommand{\link}{\htmladdnormallink}
\begin{document}			
\title{Testing Menu managers in Debian}
\author{Bill Allombert \htmladdnormallink{ballombe@debian.org}{mailto:ballombe@debian.org}}
\maketitle
\section{Introduction}

The \link{Debian menu system}{http://packages.debian.org/menu} provides an interface to build menus hierarchy for use by \textbf{menu managers}. Menu managers are usually also window managers, but there exist stand alone menu managers. 
Menu managers interface with  \link{Debian menu system}{http://packages.debian.org/menu} via \textbf{menu-methods} scripts in the directories \path{/etc/menu-methods/} and \path{\~{}/.menu-methods} which must comply with the \link{Debian menu system}{http://packages.debian.org/menu} documentation.

The aim of this document is to check the conformance of menu-methods scripts that are in \textbf{menu managers} Debian packages.

This file is available as a \link{\TeX\ file}{../wmbugs.tex}, a \link{DVI file}{../wmbugs.dvi} or a \link{HTML document}{index.html}.

Files for reproducing the tests are:
\begin{itemize}
\item \link{\path{/etc/menu/root.menu}}{../root.menu}
\item \link{\path{\~{}/.menu/user.menu}}{../user.menu}
\end{itemize}

\section{Tests Performed}

The tests were performed by adding a file \link{root.menu}{../root.menu}
in \path{/etc/menu} reading
\begin{verbatim}
?package(local.test):command="/usr/local/bin/test" needs="X11" \
                     section="Apps/Test" title="Test/slash"
?package(local.test):command="/usr/local/bin/test" needs="X11" \
                     section="Apps/Test" title="Test dnl bug"
?package(local.test):command="eval `echo /usr/local/bin/test`" needs="X11" \
                     section="Apps/Test" title="Test backquote"
\end{verbatim}
and a file \link{user.menu}{../user.menu}
in \path{\~{}/.menu/user.menu} reading
\begin{verbatim}
?package(local.test):command="/usr/local/bin/test" needs="X11" \
                     section="Apps/Test" title="U Test/slash"
?package(local.test):command="/usr/local/bin/test" needs="X11" \
                     section="Apps/Test" title="U dnl bug"
?package(local.test):command="eval `echo /usr/local/bin/test`" needs="X11" \
                     section="Apps/Test" title="U Test backquote"
\end{verbatim}
The file \path{/usr/local/bin/test} is a symlink to \path{/usr/bin/X11/xterm}.
Afterward \path{update-menus} has been run as root and as the current user.
Then each menu managers are tested in turn. Ideally a menu Apps/Test should
be created with six entry. Each entries are tested and should launch an X
terminal. They are :
\begin{itemize}
\item \menu{Test/slash}: Check if a "/" in a menu entry is allowed. Some menu
managers using directory hierarchy as menus may break. 
\item \menu{Test dnl bug} : Check if "dnl" is treated correctly. Some menu
managers preprocessing their config files with m4 may produce undefined
behavior.
\item \menu{Test backquote} : Check if backquote (`) are allowed in command.
Some menu managers may not spawn a shell correctly to handle this. Also
menu managers preprocessing their config files with m4 may produce undefined
behavior.
\item \menu{U Test/slash}, \menu{U dnl bug}, \menu{U Test backquote} are similar but are generate from user ~/.menu directory. Some menu managers does not generate these user menus out of the box.
\end{itemize}

In the results, window managers that are not menu managers are flagged N/A.
a question mark "?" denotes that I have not been able to do the test.
Anything else other than \texttt{yes} or \texttt{OK} indicate a bug.

\section{Results}
\begin{tabular}{l|lllll}
Packages & user menu & Test/slash & Test dnl bug & Test backquote & version \\
\hline
9wm &  N/A \\
aewm      & yes & OK & OK & OK & 1.1.5-1 \\
aewm++    & \multicolumn{4}{c}{ no menu } & 1.0.16-3 \\
afterstep & yes & wrong submenu & OK & disabled & 1.8.10-2 \\
amaterus  & N/A \\
amiwm & N/A \\
asclassic & no  & OK & OK & do nothing & 1.1b-24 \\
blackbox & no & OK & OK & OK & 0.62.1-1 \\
ctwm	 & no & OK & OK & OK & 3.5.2-5 \\ 
deskmenu & \multicolumn{4}{c}{ no menu displayed } & 1.3.0-6 \\
enlightenment	 & no & OK & OK & OK & 0.16.5-6 \\ 
fluxbox	 & no & OK & OK & OK & 0.1.6-2 \\ 
fluxbox-kde	 & no & OK & OK & OK & 0.1.6-2 \\ 
flwm	 & yes & wrong submenu & OK & OK & 1.00-4 \\ 
fvwm2	 & yes & OK & OK & do nothing & 2.4.5-2 \\ 
fvwm1	 & no & OK & OK & do nothing & 1.24r-44 \\ 
fvwm95	 & no & OK & OK & OK & 2.0.43ba-16.1 \\ 
gnome-panel & no & OK & OK & OK & 1.4.0.6-2 \\
gwm	 & N/A \\ 
icewm	 & yes & OK & OK & not displayed & 1.0.9.2-4 \\ 
icewm-experimental	 & yes & OK & OK & not displayed & 1.0.9.2-4 \\ 
icewm-gnome	 & yes & OK & OK & not displayed & 1.0.9.2-4 \\ 
icewm-lite	 & yes & OK & OK & not displayed & 1.0.9.2-4 \\ 
ion	 & N/A \\ 
kde kwin     & yes   & wrong submenu & OK & fail & 4:2.2.2-13 \\
larswm	 & N/A \\
lesstif mwm & no & OK & OK & OK & 1:0.93.18-4 \\ 
lwm	 & N/A \\
olvwm	 & no & OK & OK & do nothing & 4.1.3.2p1.4-15 \\ 
olwm	 & no & OK & OK & do nothing & 3.2p1.4-15 \\ 
oroborus	 & N/A \\
pdmenu   & no & OK & OK & OK & 1.2.69 \\
phluid	 & yes & OK & OK & OK & 0.0.3.2+cvs.20020210-1 \\
pwm	 & yes & OK & OK & do nothing & 1.0.20010309-7 \\ 
qvwm	 & no & OK & OK & do nothing & 1:1.1.11-0.1 \\ 
ratpoison	 & N/A \\
sapphire	 & no & OK & OK & do nothing & 0.15.8-1 \\ 
sawfish	 & yes & OK & OK & do nothing & 1.0.1.20020116-3 \\ 
sawfish-gnome	 & yes & OK & OK & do nothing & 1.0.1.20020116-3 \\ 
twm	 & no & OK & OK & OK & 4.1.0-14 \\ 
uwm	 & yes & OK & OK & OK & 0.2.8.20010609-2 \\ 
vtwm	 & no & OK & OK & OK & 5.4.5a-9 \\ 
w9wm	 & N/A \\
wm2	 & N/A \\
wmaker	 & yes & OK & OK & fail & 0.80.0-3 \\ 
xfce xfwm	 & \multicolumn{4}{c}{ Menus are scrambled} & 3.8.12b-2 \\ 
\end{tabular}
\section{Conclusion}

\begin{itemize}
\item Too many menu managers do not support user defined menu entries out of the box.

\item \path{afterstep}, \path{kwin} and \path{flwm} do not handle correctly
'/' character in menu titles. Unfortunately they cannot be fixed until menu
\link{bug \#64822}{http://bugs.debian.org/64822} and \link{bug \#136947}{http://bugs.debian.org/136947} are fixed.
In the meantime, you can use something like 

\begin{verbatim}
genmenu=ifeqelse(parent($title),"",parent($section),parent(parent($section))) "/" \ 
replacewith($title,"/","_") ifelse($command, "", "/")
\end{verbatim}

that works correctly when title contains at most on '/'. Thanks to 
Malcolm Parsons for this \link{tip}{http://bugs.debian.org/64820}.

\item Menu managers using \path{m4} to include menu files must use
\menu{undivert} and not \menu{include} because the menu file must not be
preprocessed, since menu title and command may contain words recognized as
\path{m4} macro and be wrongly expended. Thanks to Mark Eichin for the \link{tip}{http://lists.debian.org/debian-devel/2002/debian-devel-200202/msg01827.html}.

\item The \menu{Test backquote} test is probably too harsh. Several menu managers fail because they try to execute \path{/bin/sh -c"exec eval `echo /usr/local/bin/test`"} which fail with
\begin{verbatim}
sh: exec: eval: not found
\end{verbatim}
because \path{eval} is a builtin. However some of them do not evaluated command in a shell, which is wrong.

\item I have not been able to test \path{xfwm} because Debian menu entries are scrambled among others.

\end{itemize}

\section{Disclaimer}
Theses tests are carried out manually by the operator (i.e me) who have little or no knowledge about most of the menu manager tested here. Also it is an error-prone and  time consuming operation. So \link{please report}{mailto:ballombe@debian.org?subject=[wmbugs]} any error I can have made on a menu manager I may have forgot, or new results of the tests with new versions in testing.

I do not test for anyone than myself and there is absolutely no warranty.

\end{document}
