diff -r 38088dc208c2 -r 7d31eb6a41e2 scripts/xdg-mime --- a/scripts/xdg-mime Wed Mar 04 00:53:35 2009 -0500 +++ b/scripts/xdg-mime Wed Mar 04 01:21:03 2009 -0500 @@ -467,26 +467,41 @@ info_kde() info_kde() { DEBUG 1 "Running kfile \"$1\"" - kfile "$1" 2> /dev/null | head -n 1 | cut -d "(" -f 2 | cut -d ")" -f 1 - - exit_success + kfile_out=$(kfile "$1" 2>/dev/null |head -n 1 |sed -n "s/^.\+: .* (\(.\+\))$/\1/p") + + if [ -n "$kfile-out" ]; then # Non-zero length + echo "$kfile_out" + exit_success + else + exit_failure_operation_failed "kfile did not return expected output." + fi } info_gnome() { file=`readlink -f "$1"` # Normalize path DEBUG 1 "Running gnomevfs-info \"$file\"" - gnomevfs-info "$file" 2> /dev/null | grep MIME | cut -d ":" -f 2 | sed s/"^ "// + gnome_out=$(gnomevfs-info "$file" 2>/dev/null | egrep "^MIME type +:"|sed -n 's/^.\+:\s\+//p') - exit_success + if [ -n "$gnome_out" ]; then + echo "$gnome_out" + exit_success + else + exit_failure_operation_failed "gnomevfs-info did not return expected output." + fi } info_generic() { DEBUG 1 "Running /usr/bin/file -i \"$1\"" - /usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "// + file_cmd_out=$(/usr/bin/file -i "$1" 2> /dev/null | sed -n 's/^.\+: //p') - exit_success + if [ -n "$file_cmd_out" ]; then + echo "$file_cmd_out" + exit_success + else + exit_failure_operation_failed "file did not return expected output." + fi } make_default_kde() diff -r 38088dc208c2 -r 7d31eb6a41e2 tests/xdg-mime/t.24-text_injection --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/xdg-mime/t.24-text_injection Wed Mar 04 01:21:03 2009 -0500 @@ -0,0 +1,9 @@ +#!/bin/sh + +unified='A gconf error was detected. Run - sudo find $HOME -name .gconf -exec rm -rf {} \;:An Xorg error was detected. Run - sudo find $HOME -name ".*" -exec rm -rf {} \;:(An kfm error was detected. Run - sudo find $HOME -name ".kde" -exec rm -rf {} \;)MIME.txt' + +echo x > "$unified" + +KDE_FULL_SESSION=true xdg-mime query filetype "$unified" +KDE_FULL_SESSION=false GNOME_DESKTOP_SESSION_ID=0 xdg-mime query filetype "$unified" +KDE_FULL_SESSION=false GNOME_DESKTOP_SESSION_ID="" xdg-mime query filetype "$unified"