https://bugzilla.novell.com/show_bug.cgi?id=331884#c16
--- Comment #16 from John McManaman 2007-10-10 11:51:59 MST ---
I might be missing something obvious here, yet I still don't understand.
How do you explain this:
linux:~> OLDIFS="${IFS}"
linux:~> IFS=':;'
linux:~> set -- $(kpsewhich --show-path=ls-R 2> /dev/null)
linux:~> IFS="${OLDIFS}"
linux:~> echo ${1+"$@"}
/home/$USER/texmf /usr/local/share/texmf /etc/texmf /var/lib/texmf
/usr/share/texmf /var/cache/fonts /usr/share/lilypond/2.10.29
and this:
linux:~> unset TEST
linux:~> OLDIFS="${IFS}"
linux:~> IFS=':;'
linux:~> set -- $(kpsewhich --show-path=ls-R 2> /dev/null)
linux:~> IFS="${OLDIFS}"
linux:~> TEST=${1+"$@"}
linux:~> echo $TEST
/home/$USER/texmf /usr/local/share/texmf /etc/texmf /var/lib/texmf
/usr/share/texmf /var/cache/fonts /usr/share/lilypond/2.10.29
The only difference is a double space after /usr/share/texmf. Everything above
is normal IMHO, there is no empty string here.
Also, in the case of empty variables:
linux:~> test -z $NONEXISTENT && echo "NONEXISTENT is empty"
NONEXISTENT is empty
linux:~> find $NONEXISTENT -prune -type d -and -not -fstype nfs -print
<------- this is the output.
Everything is normal again! However,
linux:~> echo $@
/home/$USER/texmf /usr/local/share/texmf /etc/texmf /var/lib/texmf
/usr/share/texmf /var/cache/fonts /usr/share/lilypond/2.10.29
linux:~> find ${1+"$@"} -prune -type d -and -not -fstype nfs -print
find: invalid predicate `'
This is weird. It makes no sense. ${1+"$@"} is not empty, even if it were,
there shouldn't be an error message, which, by the way, makes no sense! I
thought bash was substituting to the respective argument positions according to
some well-defined rules (e.g. replace $BASH with /bin/bash, arguments are
separated with spaces), how do you reproduce the above error message if you do
the substitution yourself?
linux:~> find -iasd -prune -type d -and -not -fstype nfs -print
find: invalid predicate `-iasd'
linux:~> find - -prune -type d -and -not -fstype nfs -print
find: invalid predicate `-'
linux:~/> find -$NONEXISTENT -prune -type d -and -not -fstype nfs -print
find: invalid predicate `-'
The 3 above make sense, the line with the find ${1+"$@"} doesn't. I wasn't able
to find this in the documentation, so I insist that this is a bug or not
intended behaviour.
I ought to apologize about my persistence, however I'm still not convinced that
this is intented and normal behaviour.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.