On Wed, 21 Feb 2007, John Levon wrote:

> On Wed, Feb 21, 2007 at 03:57:37PM +0000, Frank Hofmann wrote:
>
>>> True, but this is special-cased now:
>>>
>>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/mdb/common/mdb/mdb_print.c#1446
>>
>> Can this be overridden ?
>>
>> If '/...' operates on the first instead of the last output work, it breaks
>> the old example:
>>
>> *log_recentq::print queue_t q_first | ::walk b_next | ::walk b_cont |
>> ::print mblk_t b_rptr | /s
>>
>> if an '-a' is inserted after the '::print'.
>
> I do not see this as inconsistent. There is no point to -a in such a case
> unless you want the address. Just don't use -a!

It does make a difference. The following:

*rootvfs::print -a vfs_t vfs_data | ::print ufsvfs_t
*rootvfs::print -a vfs_t vfs_data | ::print -a ufsvfs_t
*rootvfs::print vfs_t vfs_data | ::print ufsvfs_t
*rootvfs::print vfs_t vfs_data | ::print -a ufsvfs_t

all do the same on 'classical' but with the new are different.

Imagine longer pipes with ::print in.

Using '-a' with the new changes just makes pipelines with multiple 
sequences of ::print behave different, it depends on where you put an '-a' 
and where you don't.

Maybe it's just me. But honestly, I prefer consistency here. What mdb 
lacked for this purpose is pipe-able ::eval, or a ::cut dcmd or so, but 
not a difference in behaviour of where pipes get their input from based on 
what's on the left side of the pipe.

> It's possible that the help message could be tweaked though (if it's not
> already).

And the documentation on pipes, so that it mentions "watch what you put to 
the left side of a '|'".

I mean, I get that mdb aren't UNIX pipes. But I'd expect them to be as 
close as possible. And this one definitely isn't.


FrankH.

Reply via email to