You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "Christopher Collins (JIRA)" <ji...@apache.org> on 2017/10/27 21:54:01 UTC

[jira] [Commented] (MYNEWT-860) Newt - Empty `pkg.yml` file causes target to be built as split image

    [ https://issues.apache.org/jira/browse/MYNEWT-860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222906#comment-16222906 ] 

Christopher Collins commented on MYNEWT-860:
--------------------------------------------

Specifically, an empty {{pkg.yml}} file causes problems because it describes a package with no name.  When there is a package whose name is {{""}}, it matches some unset settings.  In this case, the target being built does not specify a {{target.loader}} value, as it is not a split image.  However, newt thinks the target actually specifies the unnamed packages as its loader, so it attempts to build a split image.

The fix is to ignore packages with no name (and warn the user).

> Newt - Empty `pkg.yml` file causes target to be built as split image
> --------------------------------------------------------------------
>
>                 Key: MYNEWT-860
>                 URL: https://issues.apache.org/jira/browse/MYNEWT-860
>             Project: Mynewt
>          Issue Type: Bug
>      Security Level: Public(Viewable by anyone) 
>          Components: Newt
>            Reporter: Christopher Collins
>            Assignee: Christopher Collins
>
> 1. Create a directory in your project:
> {noformat}
> mkdir blah
> {noformat}
> 2. Create an empty {{pkg.yml}} file in the directory:
> {noformat}
> touch blah/pkg.yml
> {noformat}
> 3. Build a non-split-image target.
> Newt will compile everything twice, as if it were building a split image.  Then it will fail in an unpredictable way, e.g.:
> {noformat}
> Error: In file included from apps/krang/src/main.c:23:0:
> repos/apache-mynewt-core/sys/sysinit/include/sysinit/sysinit.h:28:25: fatal error: split/split.h: No such file or directory
>  #include "split/split.h"
> {noformat}
> {noformat}
> panic: runtime error: invalid memory address or nil pointer dereference
> [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12a71d4]
> goroutine 1 [running]:
> mynewt.apache.org/newt/newt/pkg.(*LocalPackage).Name(...)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/paths.go:179
> mynewt.apache.org/newt/newt/builder.(*Builder).TestExePath(0xc4205307e0, 0x0, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/paths.go:179 +0x34
> mynewt.apache.org/newt/newt/builder.(*Builder).CompileCmdsPath(0xc4205307e0, 0xc420308920, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/paths.go:198 +0xad
> mynewt.apache.org/newt/newt/builder.(*Builder).Build(0xc4205307e0, 0x0, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/build.go:601 +0xa20
> mynewt.apache.org/newt/newt/builder.(*TargetBuilder).buildLoader(0xc420518120, 0x0, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/targetbuild.go:319 +0xc6
> mynewt.apache.org/newt/newt/builder.(*TargetBuilder).Build(0xc420518120, 0xc420518120, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/builder/targetbuild.go:372 +0x16d
> mynewt.apache.org/newt/newt/cli.buildRunCmd(0xc420090b40, 0xc420048d50, 0x1, 0x1, 0x0)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/cli/build_cmds.go:160 +0x2c9
> mynewt.apache.org/newt/newt/cli.AddBuildCommands.func1(0xc420090b40, 0xc420048d50, 0x1, 0x1)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/cli/build_cmds.go:404 +0x5f
> mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).execute(0xc420090b40, 0xc420048d10, 0x1, 0x1, 0xc420090b40, 0xc420048d10)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:636 +0x234
> mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200906c0, 0x5, 0x25, 0x1399e93)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:722 +0x2fe
> mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200906c0, 0x1399e93, 0x5)
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:681 +0x2b
> main.main()
>         /Users/ccollins/go/src/mynewt.apache.org/newt/newt/newt.go:170 +0x1ac
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)