On Wed, Jun 04, 2008 at 05:38:07PM -0500, Nicolas Williams wrote: > Below is my first draft of an ARC case for this. Please review.
I've played around with this and will update the proposal later this week. Here's an update of where my investigation is leading me. > Add two options for providing shell-friendly output for multi-valued > properties: > > - svcprop -m ... I'll retain this option, but svcprop will not quote any special characters in this case -- the caller will be expected to use read's -r option. An indication of embedded newlines will be provided, probably like so: % svcprop -m -c -t -p config $fmri config/foo astring <value-line-count> <value> ... % > - svcprop -o sh ... I'll retain this option as well, but it will be designed so the output is to be used as follows: % # Disable globbing and field-splitting % set -f % OIFS=$IFS % IFS= % eval set -- `svcprop -o sh -c -p $pg/$prop $fmri` % Yes, that's right: use eval. svcprop will make that safe by quoting '$', '\' and other special characters, as well as all non-US-ASCII values (except, perhaps, for props with the Unicode string type, though then maybe only if the current locale uses UTF-8 -- haven't looked closely at this yet). These are the only ways I've found of preserving property values that contain newlines, other non-printable characters, and even non-ASCII codes. I'm still evaluating the exact quoting rules that svcprop will follow. Nico --