Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95886 - config.eselect does not correctly display filenames containing spaces.
Summary: config.eselect does not correctly display filenames containing spaces.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Other
: High normal (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-06-12 12:15 UTC by Danny van Dyk (RETIRED)
Modified: 2005-06-19 03:24 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danny van Dyk (RETIRED) gentoo-dev 2005-06-12 12:15:08 UTC
--snip--
  [23]  /usr/share/config/colors/Kst
  [24]  Colors

Enter command (help to show menu)
> q
--snip--

is file: /usr/share/config/colors/._cfg0000_Kst Colors

Broken code is:
find_targets() {
	local dir targets
	for dir in $(config_protect_dirs ) ; do
		[[ -d ${dir} ]] || continue
		find ${dir} -iname '._cfg????_*' | \
			sed -e 's,^\(.*\)\._cfg...._\(.*\),\1\2,g' | sort -u
	done
}
do_list() {
	targets=( $(find_targets ) )
	write_list_start "Configuration files needing action:"
	if [[ ${#targets[@]} > 0 ]] ; then
		write_numbered_list "${targets[@]}"
	else
		write_kv_list_entry "No out of date files found"
	fi
}

Any ideas how to come around that whitespace problem?
Comment 1 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2005-06-12 13:04:06 UTC
this should work:

do_list() {
	targets=( $(find_targets ) )
	write_list_start "Configuration files needing action:"
	if [[ ${#targets[@]} > 0 ]] ; then
		targets = `echo ${targets[@]} | sed -e 's/ /\\ /'`
		write_numbered_list "${targets}"
	else
		write_kv_list_entry "No out of date files found"
	fi
}
Comment 2 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2005-06-12 13:23:05 UTC
Sorry, above isn't correct. Spaces should be escaped in find_targets:

find_targets() {
	local dir targets
	for dir in $(config_protect_dirs ) ; do
		[[ -d ${dir} ]] || continue
		find ${dir} -iname '._cfg????_*' | \
			sed -e 's,^\(.*\)\._cfg...._\(.*\),\1\2,g' | sort -u | sed -e 's/ /\\ /g'
	done
}

hope it works
Comment 3 Danny van Dyk (RETIRED) gentoo-dev 2005-06-13 06:48:04 UTC
Nope, doesn't work. I thought about this already. If it worked, i wouldn't have
opened this BUG ;-)

--snip--
  [22]  /etc/udev/scripts/cdsymlinks.sh
  [23]  /usr/share/config/colors/Kst\
  [24]  Colors
--snip--

I guess I need to update the 'write_numbered_list' function to watch out for
escaped spaces...
Comment 4 Danny van Dyk (RETIRED) gentoo-dev 2005-06-19 03:24:09 UTC
Fixed with following patch as of r155.

--- libs/output.bash.in (revision 154)
+++ libs/output.bash.in (working copy)
@@ -89,6 +89,10 @@
     while [[ ${#@} -gt 0 ]] ; do
         item=${1}
         shift
+       if [[ ${item##*\\} == "" ]] ; then
+               item="${item%\\} ${1}"
+               shift
+       fi
         write_numbered_list_entry "${n}" "${item}"
         n=$(( ${n} + 1 ))
     done
###