I have changed the Subject to mark that we are now dealing with a
different problem from original 6778894:
6786256 umountall(1M) handles incorrectly mounpoints with a space
character in the path
I do not plan to address 6786256 in the near future - hopefully no admin
wants spaces in mountpoinst, but I will record all your code to the
bugster, so it will not get lost.
Just a comment - I think that the path can contain apart from space also
newline + tab. Maybe changes similar to bquote () would handle that, but:
- it needs a really mastership in shell programming
- the umounatll(1M) would make a BIG effort to get correctly the data
out from the kernel, just to pass it later back to the kernel
I second Frank's idea to file an RFE for redesign of umountall(1M) and
if this is implemented, then 6786256 might be simpler to fix.
--Pavel
Nicolas Williams wrote:
> On Wed, Dec 17, 2008 at 10:03:09AM -0600, Nicolas Williams wrote:
>
>> To make it easier for you I wrote you the attached function to
>> backslash-quote white-space in strings. That way you can change the
>> main body of unmountall to:
>>
>
> The attachment didn't make the list, and though you have it, I forgot to
> remove debug output. So here it is inlined.
>
> bquote () {
> orig=$1
> set -- $1
> bquoted=$1
> shift
> while [ $# -gt 0 ]
> do
> case "$orig" in
> $bquoted\ ${1}*) bquoted="$bquoted\\ $1";;
> # IF YOU CUT-N-PASTE do make SURE you fix spaces
> # back to tabs in the next line!
> $bquoted\ ${1}*) bquoted="$bquoted\\ $1";;
> *) return 1;;
> esac
> shift
> done
> return 0
> }
>
> You can test it like so:
>
> while read a b c
> do
> bquote "$a"
> a=$bquoted
> bquote "$b"
> b=$bquoted
> bquote "$c"
> c=$bquoted
> echo "$a $b $c"
> done <<EOF
> foo bar baz
> foo\\ bar baz
> note the tab in the next line
> foo\\ bar baz
> EOF
>
>
> Nico
>