Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110197 - fluxbox-0.9.* fluxbox-generate_menu script improperly uses bash echo globbing command
Summary: fluxbox-0.9.* fluxbox-generate_menu script improperly uses bash echo globbing...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Commonbox Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-22 23:17 UTC by t35t0r
Modified: 2005-10-23 10:04 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
fix for fluxbox-generate_menu described in comment #2 (fluxbox-generate_menu-fix.diff,357 bytes, text/plain)
2005-10-23 00:30 UTC, t35t0r
Details

Note You need to log in before you can comment on or make changes to this bug.
Description t35t0r 2005-10-22 23:17:38 UTC
See:
https://sourceforge.net/tracker/index.php?func=detail&aid=1335255&group_id=35398&atid=413960

Basically If you run this at the bash prompt (this is independent of anything in
fluxbox-generate_menu (FBGM)):

bash ~ $ find_it () { which $1 > /dev/null 2>&1 && shift && $*; }
bash ~ $ normal_find () { while [ "$1" ]; do find_it $1 echo "[exec] ($1) {$1}";
shift; done; }
bash ~ $ normal_find firefox
c (firefox) {firefox}

it should have displayed "[exec] (firefox) {firefox}". A trivial fix is to do this:

bash ~ $ normal_find () { while [ "$1" ]; do find_it $1 echo "[exec ] ($1)
{$1}"; shift; done; }

That is put a space between the "c" and the "]". Then I get:

bash ~ $ normal_find firefox
[exec ] (firefox) {firefox}

This is ok for fluxbox, it doesn't care about whitespace but it needs the
"[exec]" or the submenu's won't work properly in the generated ~/.fluxbox/menu file.
Comment 1 t35t0r 2005-10-23 00:03:33 UTC
I've figured out the problem in a little bit more detail. In my home directory I
have a directory called "c". For some reason in that echo statement, echo
"[exec]..." it is globbing [exec] into a set that looks for the characters "e",
"x", or "c" in the path. Since the directory "c" is in the path (my home
directory) it outputs "c" since it was found.

Now for any bash gurus out there, why is it doing this? I mean the command: echo
* displays everything in the `pwd` but the command echo "*" displays '*' so why
is that echo globbing "[exec]" into [exec]?
Comment 2 t35t0r 2005-10-23 00:16:42 UTC
Here's a possible fix:

find_it () { which $1 > /dev/null 2>&1 && shift && "$@"; }

note the "$*" changed to ""$@"" and keep the same normal_find function:

normal_find () { while [ "$1" ]; do find_it $1 echo "[exec] ($1)  {$1}"; shift;
done; }

now "normal_find firefox" gives:

[exec] (firefox) {firefox}

that $* needs to be changed to "$@" everywhere that echo line exists in the
fluxbox-generate_menu command. This is just one possible way to correct this.
Comment 3 t35t0r 2005-10-23 00:30:25 UTC
Created attachment 71256 [details]
fix for fluxbox-generate_menu described in comment #2

fix for fluxbox-generate_menu described in comment #2
Comment 4 Ciaran McCreesh 2005-10-23 09:35:17 UTC
Fixed upstream r4129. I don't think this one needs a bump, but if anything else
crops up before the next release I'll include this one too.
Comment 5 t35t0r 2005-10-23 10:04:57 UTC
Yeah I think the bug at sf.net is being moved upstream also, thanks.