You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Kevin Townsend <ke...@adafruit.com> on 2016/09/25 21:11:50 UTC

newtmgr stat command error

Should the `stat` command in newtmgr be behaving similarly to the 
console command where it returns a list of all stat entries available?

That was the behaviour I was expecting, though I also tried `stat list`, 
`stat show` and `stat all` or just `stat` before looking at the 
documentation (which didn't elaborate, but not biggie there are more 
important problems to solve!).

It seems there might be an error here:

    $ newtmgr -c serial1 stat
    panic: runtime error: index out of range

    goroutine 1 [running]:
    panic(0x42965a0, 0xc820010080)
    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
    mynewt.apache.org/newt/newtmgr/cli.statsRunCmd(0xc8200df800,
    0xc82000e820, 0x0, 0x2)
    /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/cli/stats.go:57
    +0x946
    github.com/spf13/cobra.(*Command).execute(0xc8200df800,
    0xc82000e620, 0x2, 0x2, 0x0, 0x0)
    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:565 +0x85a
    github.com/spf13/cobra.(*Command).ExecuteC(0xc8200de000,
    0xc8200df800, 0x0, 0x0)
    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:651 +0x55c
    github.com/spf13/cobra.(*Command).Execute(0xc8200de000, 0x0, 0x0)
    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:610 +0x2d
    main.main()
    /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/newtmgr.go:25
    +0x25

When I run with a valid name things are fine:

    $ newtmgr -c serial1 stat ble_svc_dis
    Return Code = 0
    Stats Name: ble_svc_dis
       manufacturer_reads_stat: 0
       model_reads_stat: 0
       serial_reads_stat: 0
       firmware_rev_reads_stat: 0
       hardware_rev_reads_stat: 0
       software_rev_reads_stat: 0

It seems there isn't currently a way to know via newtmgr how many stat 
entries are present, although this information is available in the 
console version.

I'm running the latest newtmgr available in the master branch of the repo.

K.

PS: The stats module is great, BTW. The reason I enjoy using Mynewt so 
much is the (sadly uncommon) focus on real product deployments. Details 
like this make life so much easier when devices are out in the wild, but 
those 'details' tend to be forgotten in a lot of tools and platforms or 
a sad afterthought. So many RTOSes and platforms are overly academic and 
it's refreshing that the design decisions with Mynewt are being informed 
by the realities of real world product releases, and having to debug 
things in the field.


Re: newtmgr stat command error

Posted by Kevin Townsend <ke...@adafruit.com>.
Perhaps I need to dig into golang :) ... though there isn't a lot of 
room left up there for new languages anymore and I think C and Python 
have pretty much driven everything else out over the years

K.


On 26/09/16 15:12, David G. Simmons wrote:
> I reported this bug months ago. Seems the newtmgr does not check for required arguments/length. The stat command requires arguments, but newtmgr does not check that arguments are present, and then 'index out of range' exception.
>
> dg
>
>> On Sep 25, 2016, at 5:11 PM, Kevin Townsend <ke...@adafruit.com> wrote:
>>
>> Should the `stat` command in newtmgr be behaving similarly to the console command where it returns a list of all stat entries available?
>>
>> That was the behaviour I was expecting, though I also tried `stat list`, `stat show` and `stat all` or just `stat` before looking at the documentation (which didn't elaborate, but not biggie there are more important problems to solve!).
>>
>> It seems there might be an error here:
>>
>>    $ newtmgr -c serial1 stat
>>    panic: runtime error: index out of range
>>
>>    goroutine 1 [running]:
>>    panic(0x42965a0, 0xc820010080)
>>    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
>>    mynewt.apache.org/newt/newtmgr/cli.statsRunCmd(0xc8200df800,
>>    0xc82000e820, 0x0, 0x2)
>>    /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/cli/stats.go:57
>>    +0x946
>>    github.com/spf13/cobra.(*Command).execute(0xc8200df800,
>>    0xc82000e620, 0x2, 0x2, 0x0, 0x0)
>>    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:565 +0x85a
>>    github.com/spf13/cobra.(*Command).ExecuteC(0xc8200de000,
>>    0xc8200df800, 0x0, 0x0)
>>    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:651 +0x55c
>>    github.com/spf13/cobra.(*Command).Execute(0xc8200de000, 0x0, 0x0)
>>    /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:610 +0x2d
>>    main.main()
>>    /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/newtmgr.go:25
>>    +0x25
>>
>> When I run with a valid name things are fine:
>>
>>    $ newtmgr -c serial1 stat ble_svc_dis
>>    Return Code = 0
>>    Stats Name: ble_svc_dis
>>       manufacturer_reads_stat: 0
>>       model_reads_stat: 0
>>       serial_reads_stat: 0
>>       firmware_rev_reads_stat: 0
>>       hardware_rev_reads_stat: 0
>>       software_rev_reads_stat: 0
>>
>> It seems there isn't currently a way to know via newtmgr how many stat entries are present, although this information is available in the console version.
>>
>> I'm running the latest newtmgr available in the master branch of the repo.
>>
>> K.
>>
>> PS: The stats module is great, BTW. The reason I enjoy using Mynewt so much is the (sadly uncommon) focus on real product deployments. Details like this make life so much easier when devices are out in the wild, but those 'details' tend to be forgotten in a lot of tools and platforms or a sad afterthought. So many RTOSes and platforms are overly academic and it's refreshing that the design decisions with Mynewt are being informed by the realities of real world product releases, and having to debug things in the field.
>>
> --
> David G. Simmons
> (919) 534-5099
> Web <https://davidgs.com/> \u2022 Blog <https://davidgs.com/davidgs_blog> \u2022 Linkedin <http://linkedin.com/in/davidgsimmons> \u2022 Twitter <http://twitter.com/TechEvangelist1> \u2022 GitHub <http://github.com/davidgs>
> /** Message digitally signed for security and authenticity.
> * If you cannot read the PGP.sig attachment, please go to
>   * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
>   * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
> **/
> \u267a This email uses 100% recycled electrons. Don't blow it by printing!
>
> There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
>
>
>


Re: newtmgr stat command error

Posted by Christopher Collins <cc...@apache.org>.
On Mon, Sep 26, 2016 at 09:12:52AM -0400, David G. Simmons wrote:
> I reported this bug months ago. Seems the newtmgr does not check for
> required arguments/length. The stat command requires arguments, but
> newtmgr does not check that arguments are present, and then 'index out
> of range' exception. 

The Go panic (index out of range, stack trace) is definitely a bug that
should be fixed.  However, the issue that Kevin reported in the first
email (newtmgr doesn't list of stat types when required argument is
missing) is a bit tougher.  The available stat types differs by firmware
image, so the fix would require newtmgr to send a query to the device,
and the device to respond with the list of stat types that it supports.

Thanks,
Chris

Re: newtmgr stat command error

Posted by "David G. Simmons" <sa...@mac.com>.
I reported this bug months ago. Seems the newtmgr does not check for required arguments/length. The stat command requires arguments, but newtmgr does not check that arguments are present, and then 'index out of range' exception. 

dg

> On Sep 25, 2016, at 5:11 PM, Kevin Townsend <ke...@adafruit.com> wrote:
> 
> Should the `stat` command in newtmgr be behaving similarly to the console command where it returns a list of all stat entries available?
> 
> That was the behaviour I was expecting, though I also tried `stat list`, `stat show` and `stat all` or just `stat` before looking at the documentation (which didn't elaborate, but not biggie there are more important problems to solve!).
> 
> It seems there might be an error here:
> 
>   $ newtmgr -c serial1 stat
>   panic: runtime error: index out of range
> 
>   goroutine 1 [running]:
>   panic(0x42965a0, 0xc820010080)
>   /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
>   mynewt.apache.org/newt/newtmgr/cli.statsRunCmd(0xc8200df800,
>   0xc82000e820, 0x0, 0x2)
>   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/cli/stats.go:57
>   +0x946
>   github.com/spf13/cobra.(*Command).execute(0xc8200df800,
>   0xc82000e620, 0x2, 0x2, 0x0, 0x0)
>   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:565 +0x85a
>   github.com/spf13/cobra.(*Command).ExecuteC(0xc8200de000,
>   0xc8200df800, 0x0, 0x0)
>   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:651 +0x55c
>   github.com/spf13/cobra.(*Command).Execute(0xc8200de000, 0x0, 0x0)
>   /Users/ktown/prog/go/src/github.com/spf13/cobra/command.go:610 +0x2d
>   main.main()
>   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newtmgr/newtmgr.go:25
>   +0x25
> 
> When I run with a valid name things are fine:
> 
>   $ newtmgr -c serial1 stat ble_svc_dis
>   Return Code = 0
>   Stats Name: ble_svc_dis
>      manufacturer_reads_stat: 0
>      model_reads_stat: 0
>      serial_reads_stat: 0
>      firmware_rev_reads_stat: 0
>      hardware_rev_reads_stat: 0
>      software_rev_reads_stat: 0
> 
> It seems there isn't currently a way to know via newtmgr how many stat entries are present, although this information is available in the console version.
> 
> I'm running the latest newtmgr available in the master branch of the repo.
> 
> K.
> 
> PS: The stats module is great, BTW. The reason I enjoy using Mynewt so much is the (sadly uncommon) focus on real product deployments. Details like this make life so much easier when devices are out in the wild, but those 'details' tend to be forgotten in a lot of tools and platforms or a sad afterthought. So many RTOSes and platforms are overly academic and it's refreshing that the design decisions with Mynewt are being informed by the realities of real world product releases, and having to debug things in the field.
> 

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.  
* If you cannot read the PGP.sig attachment, please go to 
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.