Bug 471321

Summary: aaa_base causes root login to display "-bash: test: too many arguments" when a directory containing spaces is created under /opt
Product: [openSUSE] openSUSE 11.1 Reporter: Philip Ashmore <contact>
Component: BasesystemAssignee: Ruediger Oertel <ro>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: puzel
Version: Final   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 11.1   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Philip Ashmore 2009-02-01 03:06:59 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.5) Gecko/2008121300 SUSE/3.0.5-1.1 Firefox/3.0.5

I installed Adobe AIR FLIP.
It resides in /opt/Adobe AIR FLIP (yes, it contains spaces).

I didn't track the reason for the "-bash: test: too many arguments" appearing every time I log in as root, but some echo commands added to /etc/profile identified the problem.

Reproducible: Always

Steps to Reproduce:
1. Create a directory with spaces in it's name, such as "/opt/a b c"
2. Log in as root (for example in konsole).
Actual Results:  
-bash: test: too many arguments

Expected Results:  
A clean prompt

I tracked the problem down to /etc/profile.d/xdg-environment.sh

for xdgdir in /usr/local/share /usr/share /etc/opt/*/share /opt/*/share /usr/share/gnome ; do
   if test -d $xdgdir && test -d $xdgdir/applications; then
      if test -z "$XDG_DATA_DIRS"; then
         XDG_DATA_DIRS="$xdgdir"
      else
         XDG_DATA_DIRS="$XDG_DATA_DIRS:$xdgdir"
      fi
   fi
done

The first "test" line should be changed to
   if test -d "$xdgdir" -a -d "$xdgdir"/applications; then

This fixes the problem.
Comment 1 Philip Ashmore 2009-02-01 04:07:04 UTC
Oops that should have read

Steps to Reproduce:
1. Create a directory with spaces in it's name, with a "share" subdirectory, such as mkdir "/opt/a b c/share"
Comment 2 Philip Ashmore 2009-02-01 04:08:24 UTC
Darn!
As root,
    # mkdir -p "/opt/a b c/share"
Comment 3 Petr Uzel 2009-02-18 14:55:01 UTC
Duplicate of #463175

*** This bug has been marked as a duplicate of bug 463175 ***