Hi Andreas,

On 15/10/13 18:13, Andreas Henriksson wrote:

> You might be happy to hear that the next upstream version will include
> an option for outputting machine parsable output (in JSON format).

That's great news!

> There's no guarantee about output not changing and anyone doing
> "screenscraping" to find information should be prepared to handle

I know, I was hesitant to parse a command's output, but at the time
there was nothing better.

> the consequenses. I don't know much about python but I'm sure
> you can find a solution to talk netlink there (or write your own
> python bindings for libmnl).

Both things are far from trivial and last time (about 3 years ago) I've
checked, the lib had some problem -- I think it was not complete for my
needs. In any case, I don't want to get into that kind of complexity, I
am now looking at pyroute2, which looks promising.

>> While trying to fix a bug in python-nemu, I discovered a small bug in 
>> iproute2.
> 
> Is there a version where -oneline does link interfaces which are DOWN?

Yes, this used to work perfectly, I am not sure when this change
appeared, but it works in wheezy (20120521-3+b3):

$ ip -V
ip utility, iproute2-ss120521

$ ip -o a
[..]
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN \
link/ether de:89:3a:af:c4:47 brd ff:ff:ff:ff:ff:ff


>> The output of the command "addr show" is not consistent, depending on the -o
>> flag.
> 
> The -oneline option implies shortening the output in other ways as well.
> Please see the attached patch for your specific case.

Before reading the code, I didn't expect that. And the documentation
does not imply that either. It says only:

"output each record on a single line, replacing line feeds with the '\'
character. This is convenient when you want to count records with wc(1)
or to grep(1) the output."

At least the documentation should reflect this behaviour. And IMHO, I
think it does not make any sense to hide the DOWN interfaces only in
oneline mode.


>> As you can see, the unconfigured interfaces are not shown with the -o
>> switch, which breaks python-nemu, as it uses the parser-friendly one-line
>> format.
>>
>> Even if this looks like a minor bug, it is breaking other package, so hence 
>> the
>> normal severity.
> 
> Please convince upstream ( Stephen Hemminger <step...@networkplumber.org> )
> of your case or we'll end up with a bug tagged "wontfix", because I don't
> have any intention to diverge from upstream.

I understand that. I will talk to upstream to see if this can be reverted.

Thanks for your time!


-- 
Martín Ferrari

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to