Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-11-03 Thread Martín Ferrari
Hi again Stephen,

On 16/10/13 12:35, Stephen Hemminger wrote:

>> I am not sure I follow what you mean here. There was an incompatible
>> (and undocumented) "API" change not long ago, that in fact broke an
>> application I developed. It also happens that the change makes the
>> output/API inconsistent. What I am asking is to revert to the old behaviour.
>>
> 
> Then that was a bug. Sometimes additional stuff will get added onto the end of
> messages, with new features, but format and semantics of first part of output
> changing is not good.

I understand then than you are willing to make this change? I am asking
to know if the debian bug should be kept open or not.

Thanks!

-- 
Martín Ferrari



signature.asc
Description: OpenPGP digital signature


Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-16 Thread Stephen Hemminger
On Wed, 16 Oct 2013 17:28:34 +0200
Martín Ferrari  wrote:

> Stephen
> 
> On 16/10/13 17:24, Stephen Hemminger wrote:
> 
> >> As Andreas (the Debian maintainer) suggested, a simple patch would be to
> >> remove the two lines at
> >> http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipaddress.c#n1179
> > 
> > Changing the output format is equivalent to change the API for applications
> > that screen scrape this. I think the choice was intentional by the original
> > authors.
> 
> I am not sure I follow what you mean here. There was an incompatible
> (and undocumented) "API" change not long ago, that in fact broke an
> application I developed. It also happens that the change makes the
> output/API inconsistent. What I am asking is to revert to the old behaviour.
>

Then that was a bug. Sometimes additional stuff will get added onto the end of
messages, with new features, but format and semantics of first part of output
changing is not good.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-16 Thread Martín Ferrari
Stephen

On 16/10/13 17:24, Stephen Hemminger wrote:

>> As Andreas (the Debian maintainer) suggested, a simple patch would be to
>> remove the two lines at
>> http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipaddress.c#n1179
> 
> Changing the output format is equivalent to change the API for applications
> that screen scrape this. I think the choice was intentional by the original
> authors.

I am not sure I follow what you mean here. There was an incompatible
(and undocumented) "API" change not long ago, that in fact broke an
application I developed. It also happens that the change makes the
output/API inconsistent. What I am asking is to revert to the old behaviour.


-- 
Martín Ferrari



signature.asc
Description: OpenPGP digital signature


Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-16 Thread Stephen Hemminger
On Wed, 16 Oct 2013 12:08:29 +0200
Martín Ferrari  wrote:

> Hi Stephen,
> 
> After discussing this issue with the Debian maintainer of iproute, I am
> bringing this issue to you to see if it can be fixed in upstream.
> 
> You can see the bug report and discussion at http://bugs.debian.org/726417
> 
> Basically, the issue is that there is an inconsistency in the output of
> "ip addr show" when the -oneline option is used.
> 
> If the option is not present, ip shows all interfaces, including DOWN
> ones. When the option is used, these interfaces do not show. This is a
> regression from previous versions, as the iproute package in Debian
> Wheezy does not have this behaviour.
> 
> An example:
> 
> $ sudo modprobe dummy
> 
> $ ip addr show
> 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN
> group default
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope host lo
>valid_lft forever preferred_lft forever
> inet6 ::1/128 scope host
>valid_lft forever preferred_lft forever
> 2: wlan0:  mtu 1500 qdisc mq state
> DOWN group default qlen 1000
> [..]
> 3: eth0:  mtu 1500 qdisc pfifo_fast
> state DOWN group default qlen 1000
> [..]
> 10: wwan0:  mtu 1500 qdisc pfifo_fast
> state UP group default qlen 1000
> [..]
> 358: dummy0:  mtu 1500 qdisc noop state DOWN group default
> link/ether 42:39:cf:86:bb:39 brd ff:ff:ff:ff:ff:ff
> 
> 
> $ ip -o addr show
> 1: loinet 127.0.0.1/8 scope host lo\   valid_lft forever
> preferred_lft forever
> 1: loinet6 ::1/128 scope host \   valid_lft forever
> preferred_lft forever
> 10: wwan0inet XXX/29 brd XXX scope global wwan0\   valid_lft
> forever preferred_lft forever
> 10: wwan0inet6 XXX/64 scope link \   valid_lft forever
> preferred_lft forever
> 
> 
> As Andreas (the Debian maintainer) suggested, a simple patch would be to
> remove the two lines at
> http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipaddress.c#n1179

Changing the output format is equivalent to change the API for applications
that screen scrape this. I think the choice was intentional by the original
authors.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-16 Thread Martín Ferrari
Hi Stephen,

After discussing this issue with the Debian maintainer of iproute, I am
bringing this issue to you to see if it can be fixed in upstream.

You can see the bug report and discussion at http://bugs.debian.org/726417

Basically, the issue is that there is an inconsistency in the output of
"ip addr show" when the -oneline option is used.

If the option is not present, ip shows all interfaces, including DOWN
ones. When the option is used, these interfaces do not show. This is a
regression from previous versions, as the iproute package in Debian
Wheezy does not have this behaviour.

An example:

$ sudo modprobe dummy

$ ip addr show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN
group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
   valid_lft forever preferred_lft forever
2: wlan0:  mtu 1500 qdisc mq state
DOWN group default qlen 1000
[..]
3: eth0:  mtu 1500 qdisc pfifo_fast
state DOWN group default qlen 1000
[..]
10: wwan0:  mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
[..]
358: dummy0:  mtu 1500 qdisc noop state DOWN group default
link/ether 42:39:cf:86:bb:39 brd ff:ff:ff:ff:ff:ff


$ ip -o addr show
1: loinet 127.0.0.1/8 scope host lo\   valid_lft forever
preferred_lft forever
1: loinet6 ::1/128 scope host \   valid_lft forever
preferred_lft forever
10: wwan0inet XXX/29 brd XXX scope global wwan0\   valid_lft
forever preferred_lft forever
10: wwan0inet6 XXX/64 scope link \   valid_lft forever
preferred_lft forever


As Andreas (the Debian maintainer) suggested, a simple patch would be to
remove the two lines at
http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipaddress.c#n1179

Thanks for your time.

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

> Please convince upstream ( Stephen Hemminger  )
> of your case or we'll end up with a bug tagged "wontfix", because I don't
> have any intention to diverge from upstream.


-- 
Martín Ferrari



signature.asc
Description: OpenPGP digital signature


Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-16 Thread Martín Ferrari
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:  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  )
> 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



signature.asc
Description: OpenPGP digital signature


Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-15 Thread Andreas Henriksson
Hello!

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

There's no guarantee about output not changing and anyone doing
"screenscraping" to find information should be prepared to handle
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).

On Tue, Oct 15, 2013 at 05:37:46PM +0200, Martín Ferrari wrote:
> Package: iproute2
> Version: 3.11.0-1
> Severity: normal
> 
> 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?


> 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.

> 
> See this example:
> 
> $ sudo modprobe dummy
> 
> $ ip addr show
> 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group 
> default 
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope host lo
>valid_lft forever preferred_lft forever
> inet6 ::1/128 scope host 
>valid_lft forever preferred_lft forever
> 2: wlan0:  mtu 1500 qdisc mq state DOWN 
> group default qlen 1000
> [..]
> 3: eth0:  mtu 1500 qdisc pfifo_fast state 
> DOWN group default qlen 1000
> [..]
> 10: wwan0:  mtu 1500 qdisc pfifo_fast state 
> UP group default qlen 1000
> [..]
> 358: dummy0:  mtu 1500 qdisc noop state DOWN group default 
> link/ether 42:39:cf:86:bb:39 brd ff:ff:ff:ff:ff:ff
> 
> 
> $ ip -o addr show
> 1: loinet 127.0.0.1/8 scope host lo\   valid_lft forever 
> preferred_lft forever
> 1: loinet6 ::1/128 scope host \   valid_lft forever preferred_lft 
> forever
> 10: wwan0inet XXX/29 brd XXX scope global wwan0\   valid_lft forever 
> preferred_lft forever
> 10: wwan0inet6 XXX/64 scope link \   valid_lft forever preferred_lft 
> forever
> 
> 
> 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  )
of your case or we'll end up with a bug tagged "wontfix", because I don't
have any intention to diverge from upstream.

-- 
Andreas Henriksson
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1c3e4da..612abd8 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1176,8 +1176,10 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 	}
 
 	if (filter.family != AF_PACKET) {
+		/*
 		if (filter.oneline)
 			no_link = 1;
+		*/
 
 		if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
 			perror("Cannot send dump request");


Bug#726417: iproute2: 'ip -o addr show' does not show all interfaces (but 'ip addr show' does)

2013-10-15 Thread Martín Ferrari
Package: iproute2
Version: 3.11.0-1
Severity: normal

While trying to fix a bug in python-nemu, I discovered a small bug in iproute2.
The output of the command "addr show" is not consistent, depending on the -o
flag.

See this example:

$ sudo modprobe dummy

$ ip addr show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group 
default 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: wlan0:  mtu 1500 qdisc mq state DOWN 
group default qlen 1000
[..]
3: eth0:  mtu 1500 qdisc pfifo_fast state 
DOWN group default qlen 1000
[..]
10: wwan0:  mtu 1500 qdisc pfifo_fast state UP 
group default qlen 1000
[..]
358: dummy0:  mtu 1500 qdisc noop state DOWN group default 
link/ether 42:39:cf:86:bb:39 brd ff:ff:ff:ff:ff:ff


$ ip -o addr show
1: loinet 127.0.0.1/8 scope host lo\   valid_lft forever preferred_lft 
forever
1: loinet6 ::1/128 scope host \   valid_lft forever preferred_lft 
forever
10: wwan0inet XXX/29 brd XXX scope global wwan0\   valid_lft forever 
preferred_lft forever
10: wwan0inet6 XXX/64 scope link \   valid_lft forever preferred_lft 
forever


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.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages iproute2 depends on:
ii  libc6 2.17-93
ii  libdb5.1  5.1.29-7

Versions of packages iproute2 recommends:
pn  libatm1   
ii  libxtables10  1.4.20-2

Versions of packages iproute2 suggests:
pn  iproute2-doc  

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org