Openembedded Core Discussions
 help / color / mirror / Atom feed
* [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
@ 2016-10-06  8:23 Martin Jansa
  2016-10-06 10:45 ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Jansa @ 2016-10-06  8:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christophe Chapuis

From: Christophe Chapuis <chris.chapuis@gmail.com>

* this patch is backported from 2.26.1 which is already in oe-core/master
  since this patch:
  commit 37e8b6ecf9f9163d7b5b3becdc2feba57df4838f
  Author: Khem Raj <raj.khem@gmail.com>
  Date:   Thu Jul 7 11:08:29 2016 -0700
  Subject: binutils: Upgrade to 2.26.1

  -SRCREV = "71fa566a9cf2597b60a58c1d7c148bab637454a6"
  +SRCREV = "c29838e7f484e0b5714b02e7feb9a88d3a045dd2"

* verified that the patch exists in this SRCREV range:
  ~/projects/binutils $ git log --oneline 71fa566a9cf2597b60a58c1d7c148bab637454a6..c29838e7f484e0b5714b02e7feb9a88d3a045dd2^C
  ...
  343a405 Allow zero length archive elements
  ...
  so it isn't needed in master branch

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-devtools/binutils/binutils-2.26.inc   |   1 +
 .../binutils/0015-allow-zero-length-elements.patch | 130 +++++++++++++++++++++
 2 files changed, 131 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch

diff --git a/meta/recipes-devtools/binutils/binutils-2.26.inc b/meta/recipes-devtools/binutils/binutils-2.26.inc
index 06ce245..4b33b04 100644
--- a/meta/recipes-devtools/binutils/binutils-2.26.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.26.inc
@@ -34,6 +34,7 @@ SRC_URI = "\
      file://0012-Add-support-for-Netlogic-XLP.patch \
      file://0013-Fix-GOT-address-computations-in-initial-PLT-entries-.patch \
      file://0014-Correct-nios2-_gp-address-computation.patch \
+     file://0015-allow-zero-length-elements.patch \
      file://aarch64-tls.patch \
 "
 S  = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch b/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch
new file mode 100644
index 0000000..3a19fca
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0015-allow-zero-length-elements.patch
@@ -0,0 +1,130 @@
+From 343a405c03ce478634d8ce5a38faae832d39b361 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Wed, 9 Mar 2016 17:01:54 +1030
+Subject: [PATCH] Allow zero length archive elements
+
+bfd/
+	PR binutils/19775
+	* archive.c (bfd_generic_openr_next_archived_file): Allow zero
+	length elements in the archive.
+	* coff-alpha.c (alpha_ecoff_openr_next_archived_file): Likewise.
+
+binutils/
+	PR binutils/19775
+	* testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
+	Run the new proc.
+	* testsuite/binutils-all/empty: New, empty, file.
+---
+ bfd/ChangeLog                          |    8 ++++++
+ bfd/archive.c                          |    2 +-
+ bfd/coff-alpha.c                       |    2 +-
+ binutils/ChangeLog                     |    7 +++++
+ binutils/testsuite/binutils-all/ar.exp |   40 ++++++++++++++++++++++++++++++++
+ 5 files changed, 57 insertions(+), 2 deletions(-)
+ create mode 100644 binutils/testsuite/binutils-all/empty
+
+diff --git a/bfd/archive.c b/bfd/archive.c
+index b3d03d3..1fc3a94 100644
+--- a/bfd/archive.c
++++ b/bfd/archive.c
+@@ -802,7 +802,7 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
+ 	     Note that last_file->origin can be odd in the case of
+ 	     BSD-4.4-style element with a long odd size.  */
+ 	  filestart += filestart % 2;
+-	  if (filestart <= last_file->proxy_origin)
++	  if (filestart < last_file->proxy_origin)
+ 	    {
+ 	      /* Prevent looping.  See PR19256.  */
+ 	      bfd_set_error (bfd_error_malformed_archive);
+diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
+index 7478f2f..fffb9f7 100644
+--- a/bfd/coff-alpha.c
++++ b/bfd/coff-alpha.c
+@@ -2208,7 +2208,7 @@ alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
+ 	 BSD-4.4-style element with a long odd size.  */
+       filestart = last_file->proxy_origin + size;
+       filestart += filestart % 2;
+-      if (filestart <= last_file->proxy_origin)
++      if (filestart < last_file->proxy_origin)
+ 	{
+ 	  /* Prevent looping.  See PR19256.  */
+ 	  bfd_set_error (bfd_error_malformed_archive);
+diff --git a/binutils/ChangeLog b/binutils/ChangeLog
+index 4648d93..b04c745 100644
+--- a/binutils/ChangeLog
++++ b/binutils/ChangeLog
+@@ -1,3 +1,10 @@
++2016-03-09  Nick Clifton  <nickc@redhat.com>
++
++	PR binutils/19775
++	* testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
++	Run the new proc.
++	* testsuite/binutils-all/empty: New, empty, file.
++
+ 2016-02-12  H.J. Lu  <hongjiu.lu@intel.com>
+ 
+ 	Backport from master
+diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
+index 4c33874..e971350 100644
+--- a/binutils/testsuite/binutils-all/ar.exp
++++ b/binutils/testsuite/binutils-all/ar.exp
+@@ -555,6 +555,45 @@ proc move_an_element { } {
+     pass $testname
+ }
+ 
++# PR 19775: Test creating and listing archives with an empty element.
++
++proc empty_archive { } {
++    global AR
++    global srcdir
++    global subdir
++
++    set testname "archive with empty element"
++
++    # FIXME: There ought to be a way to dynamically create an empty file.
++    set empty $srcdir/$subdir/empty
++    
++    if [is_remote host] {
++	set archive artest.a
++	set objfile [remote_download host $empty]
++	remote_file host delete $archive
++    } else {
++	set archive tmpdir/artest.a
++	set objfile $empty
++    }
++
++    remote_file build delete tmpdir/artest.a
++
++    set got [binutils_run $AR "-r -c $archive ${objfile}"]
++    if ![string match "" $got] {
++	fail $testname
++	return
++    }
++
++    # This commmand used to fail with: "Malformed archive".
++    set got [binutils_run $AR "-t $archive"]
++    if ![string match "empty
" $got] {
++	fail $testname
++	return
++    }
++
++    pass $testname
++}
++
+ # Run the tests.
+ 
+ # Only run the bfdtest checks if the programs exist.  Since these
+@@ -574,6 +613,7 @@ argument_parsing
+ deterministic_archive
+ delete_an_element
+ move_an_element
++empty_archive
+ 
+ if { [is_elf_format]
+      && ![istarget "*-*-hpux*"]
+diff --git a/binutils/testsuite/binutils-all/empty b/binutils/testsuite/binutils-all/empty
+new file mode 100644
+index 0000000..e69de29
+-- 
+1.7.1
+
-- 
2.10.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
  2016-10-06  8:23 [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries Martin Jansa
@ 2016-10-06 10:45 ` Richard Purdie
  2016-10-06 10:46   ` Martin Jansa
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2016-10-06 10:45 UTC (permalink / raw)
  To: Martin Jansa, openembedded-core; +Cc: Christophe Chapuis

On Thu, 2016-10-06 at 10:23 +0200, Martin Jansa wrote:
> ++    # This commmand used to fail with: "Malformed archive".
> ++    set got [binutils_run $AR "-t $archive"]
> ++    if ![string match "empty
> " $got] {
> ++	fail $testname
> ++	return
> ++    }
> ++
> ++    pass $testname

The patch fails to apply due to the above corruption (line not starting
++). Could you resend or point to a branch with the patch on please?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
  2016-10-06 10:45 ` Richard Purdie
@ 2016-10-06 10:46   ` Martin Jansa
  2016-10-06 10:54     ` Martin Jansa
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Jansa @ 2016-10-06 10:46 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Christophe Chapuis,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

Strange,

it's included here:
http://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/krogoth-backports

until next rebase it's this commit SHA:
http://git.openembedded.org/openembedded-core-contrib/commit/?h=jansa/krogoth-backports&id=9d56d74bc2f42cbd6ee6ad1dbddb378a020bbe93

Thanks for quick reply

On Thu, Oct 6, 2016 at 12:45 PM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Thu, 2016-10-06 at 10:23 +0200, Martin Jansa wrote:
> > ++    # This commmand used to fail with: "Malformed archive".
> > ++    set got [binutils_run $AR "-t $archive"]
> > ++    if ![string match "empty
> > " $got] {
> > ++    fail $testname
> > ++    return
> > ++    }
> > ++
> > ++    pass $testname
>
> The patch fails to apply due to the above corruption (line not starting
> ++). Could you resend or point to a branch with the patch on please?
>
> Cheers,
>
> Richard
>

[-- Attachment #2: Type: text/html, Size: 1713 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
  2016-10-06 10:46   ` Martin Jansa
@ 2016-10-06 10:54     ` Martin Jansa
  2016-10-06 11:12       ` Martin Jansa
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Jansa @ 2016-10-06 10:54 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Christophe Chapuis,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

I see this strange line also in that branch, I'm checking log.do_patch to
see how it's possible that it did apply to me OK.

On Thu, Oct 6, 2016 at 12:46 PM, Martin Jansa <martin.jansa@gmail.com>
wrote:

> Strange,
>
> it's included here:
> http://git.openembedded.org/openembedded-core-contrib/log/
> ?h=jansa/krogoth-backports
>
> until next rebase it's this commit SHA:
> http://git.openembedded.org/openembedded-core-contrib/
> commit/?h=jansa/krogoth-backports&id=9d56d74bc2f42cbd6ee6ad1dbddb37
> 8a020bbe93
>
> Thanks for quick reply
>
> On Thu, Oct 6, 2016 at 12:45 PM, Richard Purdie <richard.purdie@
> linuxfoundation.org> wrote:
>
>> On Thu, 2016-10-06 at 10:23 +0200, Martin Jansa wrote:
>> > ++    # This commmand used to fail with: "Malformed archive".
>> > ++    set got [binutils_run $AR "-t $archive"]
>> > ++    if ![string match "empty
>> > " $got] {
>> > ++    fail $testname
>> > ++    return
>> > ++    }
>> > ++
>> > ++    pass $testname
>>
>> The patch fails to apply due to the above corruption (line not starting
>> ++). Could you resend or point to a branch with the patch on please?
>>
>> Cheers,
>>
>> Richard
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2333 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
  2016-10-06 10:54     ` Martin Jansa
@ 2016-10-06 11:12       ` Martin Jansa
  2016-10-06 13:10         ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Jansa @ 2016-10-06 11:12 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Christophe Chapuis,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1984 bytes --]

I see, there is ^M after empty in the actual .patch file, if I read the git
format-patch output it shows ^M, but the git webUI gets confused and shows
^M as normal line feed.

++    if ![string match "empty^M" $got] {

Does it work for you when cherry-picking from the branch.

Here is the same change in binutils git repo:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blobdiff;f=binutils/testsuite/binutils-all/ar.exp;h=45be9b1b594b39624f3e010f50bf98892fb64549;hp=508ae9c1d7562c8b0a2c090a93e35acdba733944;hb=4fc874242f8f1bf17cf6e65b159dd804e793e6cd;hpb=23a4bd22c75862fdbaa5faef59b9094ec738f675

It shows '\r' so it isn't there by accident.


On Thu, Oct 6, 2016 at 12:54 PM, Martin Jansa <martin.jansa@gmail.com>
wrote:

> I see this strange line also in that branch, I'm checking log.do_patch to
> see how it's possible that it did apply to me OK.
>
> On Thu, Oct 6, 2016 at 12:46 PM, Martin Jansa <martin.jansa@gmail.com>
> wrote:
>
>> Strange,
>>
>> it's included here:
>> http://git.openembedded.org/openembedded-core-contrib/log/?
>> h=jansa/krogoth-backports
>>
>> until next rebase it's this commit SHA:
>> http://git.openembedded.org/openembedded-core-contrib/commit
>> /?h=jansa/krogoth-backports&id=9d56d74bc2f42cbd6ee6ad1dbddb378a020bbe93
>>
>> Thanks for quick reply
>>
>> On Thu, Oct 6, 2016 at 12:45 PM, Richard Purdie <
>> richard.purdie@linuxfoundation.org> wrote:
>>
>>> On Thu, 2016-10-06 at 10:23 +0200, Martin Jansa wrote:
>>> > ++    # This commmand used to fail with: "Malformed archive".
>>> > ++    set got [binutils_run $AR "-t $archive"]
>>> > ++    if ![string match "empty
>>> > " $got] {
>>> > ++    fail $testname
>>> > ++    return
>>> > ++    }
>>> > ++
>>> > ++    pass $testname
>>>
>>> The patch fails to apply due to the above corruption (line not starting
>>> ++). Could you resend or point to a branch with the patch on please?
>>>
>>> Cheers,
>>>
>>> Richard
>>>
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 3911 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries
  2016-10-06 11:12       ` Martin Jansa
@ 2016-10-06 13:10         ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2016-10-06 13:10 UTC (permalink / raw)
  To: Martin Jansa
  Cc: Christophe Chapuis,
	Patches and discussions about the oe-core layer

On Thu, 2016-10-06 at 13:12 +0200, Martin Jansa wrote:
> I see, there is ^M after empty in the actual .patch file, if I read
> the git format-patch output it shows ^M, but the git webUI gets
> confused and shows ^M as normal line feed.
> 
> ++    if ![string match "empty^M" $got] {
> 
> Does it work for you when cherry-picking from the branch.
> 
> Here is the same change in binutils git repo:
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blobdiff;f
> =binutils/testsuite/binutils-
> all/ar.exp;h=45be9b1b594b39624f3e010f50bf98892fb64549;hp=508ae9c1d756
> 2c8b0a2c090a93e35acdba733944;hb=4fc874242f8f1bf17cf6e65b159dd804e793e
> 6cd;hpb=23a4bd22c75862fdbaa5faef59b9094ec738f675
> 
> It shows '\r' so it isn't there by accident.

I've been able to cherry-pick it, thanks. I figured it was something
odd going on with the mailing list damaging line returns.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-06 13:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-06  8:23 [krogoth][PATCH] binutils: fix AR issue when opkg is unpacking IPKs containing empty entries Martin Jansa
2016-10-06 10:45 ` Richard Purdie
2016-10-06 10:46   ` Martin Jansa
2016-10-06 10:54     ` Martin Jansa
2016-10-06 11:12       ` Martin Jansa
2016-10-06 13:10         ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox