summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2015-12-09 18:09:58 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-16 12:12:17 +0000
commitd3014511cb403f1b6348570d8150fc93100b8c28 (patch)
tree26223fb7cc2f5fa8038868fbbf3c9e81f5abc2b8
parent2bea0066b00a4b53d92ca85b540a44c24feb233f (diff)
downloadpoky-d3014511cb403f1b6348570d8150fc93100b8c28.tar.gz
cpio: update to 2.12
Drop backported patches: Fix-symlink-bad-length-test-for-64-bit-architectures.patch fix-memory-overrun.patch fix-testcase-symlink-bad-lengths.patch 0001-fix-testcase-of-symlink-bad-length.patch statdef.patch is fixing code that doesn't exist anymore. The problem handled by remove-gets.patch has been fixed differently. The CVE-2015-1197 has been ignored by upstream and had to be rebased: http://lists.gnu.org/archive/html/bug-cpio/2015-09/msg00007.html (From OE-Core rev: feeaa86eb8b1071d56eb6d7ad7120aa389c736a0) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/0001-fix-testcase-of-symlink-bad-length.patch57
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/Fix-symlink-bad-length-test-for-64-bit-architectures.patch36
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/fix-memory-overrun.patch220
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/fix-testcase-symlink-bad-lengths.patch33
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/remove-gets.patch20
-rw-r--r--meta/recipes-extended/cpio/cpio-2.11/statdef.patch17
-rw-r--r--meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch (renamed from meta/recipes-extended/cpio/cpio-2.11/cpio-CVE-2015-1197.patch)103
-rw-r--r--meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch (renamed from meta/recipes-extended/cpio/cpio-2.11/0001-Unset-need_charset_alias-when-building-for-musl.patch)0
-rw-r--r--meta/recipes-extended/cpio/cpio_2.11.bb18
-rw-r--r--meta/recipes-extended/cpio/cpio_2.12.bb12
-rw-r--r--meta/recipes-extended/cpio/cpio_2.8.bb4
-rw-r--r--meta/recipes-extended/cpio/cpio_v2.inc1
12 files changed, 78 insertions, 443 deletions
diff --git a/meta/recipes-extended/cpio/cpio-2.11/0001-fix-testcase-of-symlink-bad-length.patch b/meta/recipes-extended/cpio/cpio-2.11/0001-fix-testcase-of-symlink-bad-length.patch
deleted file mode 100644
index 642f557ac8..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/0001-fix-testcase-of-symlink-bad-length.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1Upstream-Status: Backport
2
3Subject: fix testcase of symlink-bad-length
4
5Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
6---
7 tests/symlink-bad-length.at | 24 ++++++++++++++++++++----
8 1 file changed, 20 insertions(+), 4 deletions(-)
9
10diff --git a/tests/symlink-bad-length.at b/tests/symlink-bad-length.at
11index 74208ce..11fc6ce 100644
12--- a/tests/symlink-bad-length.at
13+++ b/tests/symlink-bad-length.at
14@@ -1,5 +1,5 @@
15 # Process this file with autom4te to create testsuite. -*- Autotest -*-
16-# Copyright (C) 2014 Free Software Foundation, Inc.
17+# Copyright (C) 2014-2015 Free Software Foundation, Inc.
18
19 # This program is free software; you can redistribute it and/or modify
20 # it under the terms of the GNU General Public License as published by
21@@ -35,14 +35,30 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
22 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
23 ])
24
25+# The exact error message and exit status depend on the host architecture,
26+# therefore strderr is filtered out and error code is not checked.
27+
28+# So far the only case when cpio would exit with code 0 is when it skips
29+# several bytes and encounters a valid record header. Perhaps it should
30+# exit with code 2 (non-critical error), if at least one byte was skipped,
31+# but that could hurt backward compatibility.
32+
33 AT_CHECK([
34 base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
35-cpio -ntv < ARCHIVE
36-test $? -eq 2
37+TZ=UTC cpio -ntv < ARCHIVE 2>stderr
38+cat stderr | grep -v \
39+ -e 'stored filename length is out of range' \
40+ -e 'premature end of file' \
41+ -e 'archive header has reverse byte-order' \
42+ -e 'memory exhausted' \
43+ -e 'skipped [[0-9][0-9]*] bytes of junk' \
44+ -e '[[0-9][0-9]*] block' \
45+ >&2
46+echo >&2 STDERR
47 ],
48 [0],
49 [-rw-rw-r-- 1 10029 10031 13 Nov 25 2014 FILE
50-],[cpio: premature end of file
51+],[STDERR
52 ])
53
54 AT_CLEANUP
55--
561.9.1
57
diff --git a/meta/recipes-extended/cpio/cpio-2.11/Fix-symlink-bad-length-test-for-64-bit-architectures.patch b/meta/recipes-extended/cpio/cpio-2.11/Fix-symlink-bad-length-test-for-64-bit-architectures.patch
deleted file mode 100644
index c2da9e1628..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/Fix-symlink-bad-length-test-for-64-bit-architectures.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 0e8d8ed494433237cff0ad6c513c40f025005e8c Mon Sep 17 00:00:00 2001
2From: Jun Zhang <jun.zhang@windriver.com>
3Date: Fri, 16 Oct 2015 10:48:21 +0800
4Subject: [PATCH] Fix symlink-bad-length test for 64-bit architectures.
5
6* src/util.c: Return non-zero exit code if EOF is hit prematurely.
7
8Backport commit:
9http://git.savannah.gnu.org/cgit/cpio.git/commit/src/util.c?id=f6a8a2cbd2d5ca40ea94900b55b845dd5ca87328
10
11Upstream-Status: Backport
12
13Signed-off-by: Jun Zhang <jun.zhang@windriver.com>
14---
15 src/util.c | 5 +----
16 1 file changed, 1 insertion(+), 4 deletions(-)
17
18diff --git a/src/util.c b/src/util.c
19index 00953d5..b536d82 100644
20--- a/src/util.c
21+++ b/src/util.c
22@@ -206,10 +206,7 @@ tape_fill_input_buffer (int in_des, int num_bytes)
23 if (input_size < 0)
24 error (1, errno, _("read error"));
25 if (input_size == 0)
26- {
27- error (0, 0, _("premature end of file"));
28- exit (1);
29- }
30+ error (PAXEXIT_FAILURE, 0, _("premature end of file"));
31 input_bytes += input_size;
32 }
33
34--
351.9.1
36
diff --git a/meta/recipes-extended/cpio/cpio-2.11/fix-memory-overrun.patch b/meta/recipes-extended/cpio/cpio-2.11/fix-memory-overrun.patch
deleted file mode 100644
index 89cd3cfa50..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/fix-memory-overrun.patch
+++ /dev/null
@@ -1,220 +0,0 @@
1cpio: Fix memory overrun on reading improperly created link records
2
3Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
4
5http://git.savannah.gnu.org/cgit/cpio.git/commit/?id=746f3ff670dcfcdd28fcc990e79cd6fccc7ae48d
6
7 * src/copyin.c (get_link_name): New function.
8 (list_file, copyin_link): use get_link_name
9
10 * tests/symlink-bad-length.at: New file.
11 * tests/symlink-long.at: New file.
12 * tests/Makefile.am: Add new files.
13 * tests/testsuite.at: Likewise.
14
15 See http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
16
17Upstream-Status: Backport
18
19Signed-off-by: Sergey Poznyakoff <gray@gnu.org.ua>
20
21diff -Nurp cpio-2.11.orig/src/copyin.c cpio-2.11/src/copyin.c
22--- cpio-2.11.orig/src/copyin.c 2010-02-15 18:02:23.000000000 +0800
23+++ cpio-2.11/src/copyin.c 2014-12-08 13:14:04.355547508 +0800
24@@ -126,6 +126,28 @@ tape_skip_padding (int in_file_des, off_
25 }
26
27
28+static char *
29+get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
30+{
31+ off_t n = file_hdr->c_filesize + 1;
32+ char *link_name;
33+
34+ if (n == 0 || n > SIZE_MAX)
35+ {
36+ error (0, 0, _("%s: stored filename length too big"), file_hdr->c_name);
37+ link_name = NULL;
38+ }
39+ else
40+ {
41+ link_name = xmalloc (n);
42+ tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
43+ link_name[file_hdr->c_filesize] = '\0';
44+ tape_skip_padding (in_file_des, file_hdr->c_filesize);
45+ }
46+ return link_name;
47+}
48+
49+
50 static void
51 list_file(struct cpio_file_stat* file_hdr, int in_file_des)
52 {
53@@ -136,21 +158,16 @@ list_file(struct cpio_file_stat* file_hd
54 {
55 if (archive_format != arf_tar && archive_format != arf_ustar)
56 {
57- char *link_name = NULL; /* Name of hard and symbolic links. */
58-
59- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
60- link_name[file_hdr->c_filesize] = '\0';
61- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
62- long_format (file_hdr, link_name);
63- free (link_name);
64- tape_skip_padding (in_file_des, file_hdr->c_filesize);
65- return;
66+ char *link_name = get_link_name (file_hdr, in_file_des);
67+ if (link_name)
68+ {
69+ long_format (file_hdr, link_name);
70+ free (link_name);
71+ }
72 }
73 else
74- {
75 long_format (file_hdr, file_hdr->c_tar_linkname);
76- return;
77- }
78+ return;
79 }
80 else
81 #endif
82@@ -650,10 +667,7 @@ copyin_link(struct cpio_file_stat *file_
83
84 if (archive_format != arf_tar && archive_format != arf_ustar)
85 {
86- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
87- link_name[file_hdr->c_filesize] = '\0';
88- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
89- tape_skip_padding (in_file_des, file_hdr->c_filesize);
90+ link_name = get_link_name (file_hdr, in_file_des);
91 }
92 else
93 {
94diff -Nurp cpio-2.11.orig/tests/Makefile.am cpio-2.11/tests/Makefile.am
95--- cpio-2.11.orig/tests/Makefile.am 2010-02-15 18:02:23.000000000 +0800
96+++ cpio-2.11/tests/Makefile.am 2014-12-08 13:14:49.931545727 +0800
97@@ -52,6 +52,8 @@ TESTSUITE_AT = \
98 setstat04.at\
99 setstat05.at\
100 symlink.at\
101+ symlink-bad-length.at\
102+ symlink-long.at\
103 version.at
104
105 TESTSUITE = $(srcdir)/testsuite
106diff -Nurp cpio-2.11.orig/tests/symlink-bad-length.at cpio-2.11/tests/symlink-bad-length.at
107--- cpio-2.11.orig/tests/symlink-bad-length.at 1970-01-01 08:00:00.000000000 +0800
108+++ cpio-2.11/tests/symlink-bad-length.at 2014-12-08 13:17:45.979538847 +0800
109@@ -0,0 +1,49 @@
110+# Process this file with autom4te to create testsuite. -*- Autotest -*-
111+# Copyright (C) 2014 Free Software Foundation, Inc.
112+
113+# This program is free software; you can redistribute it and/or modify
114+# it under the terms of the GNU General Public License as published by
115+# the Free Software Foundation; either version 3, or (at your option)
116+# any later version.
117+
118+# This program is distributed in the hope that it will be useful,
119+# but WITHOUT ANY WARRANTY; without even the implied warranty of
120+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
121+# GNU General Public License for more details.
122+
123+# You should have received a copy of the GNU General Public License
124+# along with this program; if not, write to the Free Software
125+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
126+# 02110-1301 USA.
127+
128+# Cpio v2.11 did segfault with badly set symlink length.
129+# References:
130+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
131+
132+AT_SETUP([symlink-bad-length])
133+AT_KEYWORDS([symlink-long copyout])
134+
135+AT_DATA([ARCHIVE.base64],
136+[x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
137+JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
138+UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
139+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
140+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
141+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
142+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
143+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
144+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
145+])
146+
147+AT_CHECK([
148+base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
149+cpio -ntv < ARCHIVE
150+test $? -eq 2
151+],
152+[0],
153+[-rw-rw-r-- 1 10029 10031 13 Nov 25 13:52 FILE
154+],[cpio: LINK: stored filename length too big
155+cpio: premature end of file
156+])
157+
158+AT_CLEANUP
159diff -Nurp cpio-2.11.orig/tests/symlink-long.at cpio-2.11/tests/symlink-long.at
160--- cpio-2.11.orig/tests/symlink-long.at 1970-01-01 08:00:00.000000000 +0800
161+++ cpio-2.11/tests/symlink-long.at 2014-12-08 13:17:57.219538408 +0800
162@@ -0,0 +1,46 @@
163+# Process this file with autom4te to create testsuite. -*- Autotest -*-
164+# Copyright (C) 2014 Free Software Foundation, Inc.
165+
166+# This program is free software; you can redistribute it and/or modify
167+# it under the terms of the GNU General Public License as published by
168+# the Free Software Foundation; either version 3, or (at your option)
169+# any later version.
170+
171+# This program is distributed in the hope that it will be useful,
172+# but WITHOUT ANY WARRANTY; without even the implied warranty of
173+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174+# GNU General Public License for more details.
175+
176+# You should have received a copy of the GNU General Public License
177+# along with this program; if not, write to the Free Software
178+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
179+# 02110-1301 USA.
180+
181+# Cpio v2.11.90 changed the way symlink name is read from archive.
182+# References:
183+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
184+
185+AT_SETUP([symlink-long])
186+AT_KEYWORDS([symlink-long copyout])
187+
188+AT_CHECK([
189+
190+# len(dirname) > READBUFSIZE
191+dirname=
192+for i in {1..52}; do
193+ dirname="xxxxxxxxx/$dirname"
194+ mkdir "$dirname"
195+done
196+ln -s "$dirname" x || AT_SKIP_TEST
197+
198+echo x | cpio -o > ar
199+list=`cpio -tv < ar | sed 's|.*-> ||'`
200+test "$list" = "$dirname" && echo success || echo fail
201+],
202+[0],
203+[success
204+],[2 blocks
205+2 blocks
206+])
207+
208+AT_CLEANUP
209diff -Nurp cpio-2.11.orig/tests/testsuite.at cpio-2.11/tests/testsuite.at
210--- cpio-2.11.orig/tests/testsuite.at 2010-02-15 18:02:23.000000000 +0800
211+++ cpio-2.11/tests/testsuite.at 2014-12-08 13:15:13.515544805 +0800
212@@ -31,6 +31,8 @@ m4_include([version.at])
213
214 m4_include([inout.at])
215 m4_include([symlink.at])
216+m4_include([symlink-bad-length.at])
217+m4_include([symlink-long.at])
218 m4_include([interdir.at])
219
220 m4_include([setstat01.at])
diff --git a/meta/recipes-extended/cpio/cpio-2.11/fix-testcase-symlink-bad-lengths.patch b/meta/recipes-extended/cpio/cpio-2.11/fix-testcase-symlink-bad-lengths.patch
deleted file mode 100644
index a325f4bac8..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/fix-testcase-symlink-bad-lengths.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From c213ffa2e0ba6677e0dfade9c67b91446c70c8bd Mon Sep 17 00:00:00 2001
2From: Jun Zhang <jun.zhang@windriver.com>
3Date: Fri, 16 Oct 2015 21:25:17 +0800
4Subject: [PATCH] cpio: fix testcase symlink-bad-lengths
5
6* fix the output of stderr & stdout to meet latest cpio
7
8Upstream-Status: Pending
9
10Signed-off-by: Jun Zhang <jun.zhang@windriver.com>
11---
12 tests/symlink-bad-length.at | 5 ++---
13 1 file changed, 2 insertions(+), 3 deletions(-)
14
15diff --git a/tests/symlink-bad-length.at b/tests/symlink-bad-length.at
16index 6f804b1..74208ce 100644
17--- a/tests/symlink-bad-length.at
18+++ b/tests/symlink-bad-length.at
19@@ -41,9 +41,8 @@ cpio -ntv < ARCHIVE
20 test $? -eq 2
21 ],
22 [0],
23-[-rw-rw-r-- 1 10029 10031 13 Nov 25 13:52 FILE
24-],[cpio: LINK: stored filename length too big
25-cpio: premature end of file
26+[-rw-rw-r-- 1 10029 10031 13 Nov 25 2014 FILE
27+],[cpio: premature end of file
28 ])
29
30 AT_CLEANUP
31--
321.9.1
33
diff --git a/meta/recipes-extended/cpio/cpio-2.11/remove-gets.patch b/meta/recipes-extended/cpio/cpio-2.11/remove-gets.patch
deleted file mode 100644
index b4d113d3a5..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/remove-gets.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1ISO C11 removes the specification of gets() from the C language, eglibc 2.16+ removed it
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4
5Upstream-Status: Pending
6Index: cpio-2.11/gnu/stdio.in.h
7===================================================================
8--- cpio-2.11.orig/gnu/stdio.in.h 2012-07-04 12:13:43.133066247 -0700
9+++ cpio-2.11/gnu/stdio.in.h 2012-07-04 12:14:10.189067564 -0700
10@@ -138,8 +138,10 @@
11 /* It is very rare that the developer ever has full control of stdin,
12 so any use of gets warrants an unconditional warning. Assume it is
13 always declared, since it is required by C89. */
14+#if defined gets
15 #undef gets
16 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
17+#endif
18
19 #if @GNULIB_FOPEN@
20 # if @REPLACE_FOPEN@
diff --git a/meta/recipes-extended/cpio/cpio-2.11/statdef.patch b/meta/recipes-extended/cpio/cpio-2.11/statdef.patch
deleted file mode 100644
index a6b8e82a0b..0000000000
--- a/meta/recipes-extended/cpio/cpio-2.11/statdef.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Avoid multiple stat definitions
2Patch taken from cpio mailing list posting 2010-03-19
3
4Upstream-Status: Pending
5
6Signed-off-by: Scott Garman <scott.a.garman@intel.com>
7
8diff -urN cpio-2.11.orig/src/filetypes.h cpio-2.11/src/filetypes.h
9--- cpio-2.11.orig/src/filetypes.h 2010-02-12 02:19:23.000000000 -0800
10+++ cpio-2.11/src/filetypes.h 2010-07-23 13:17:25.000000000 -0700
11@@ -82,4 +82,6 @@
12 #define lstat stat
13 #endif
14 int lstat ();
15+#ifndef stat
16 int stat ();
17+#endif
diff --git a/meta/recipes-extended/cpio/cpio-2.11/cpio-CVE-2015-1197.patch b/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch
index b54afb867f..8f719ad8d6 100644
--- a/meta/recipes-extended/cpio/cpio-2.11/cpio-CVE-2015-1197.patch
+++ b/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch
@@ -1,28 +1,44 @@
1Description: CVE-2015-1197 1From dcee489f821c1260a0136fcdfdb6ff4dd11086ac Mon Sep 17 00:00:00 2001
2 Apply patch by Vitezslav Cizek of SuSE to fix CVE-2015-1197. 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3 Upstream is dormant or no longer existing. To restore the old 3Date: Wed, 9 Dec 2015 17:58:03 +0200
4 behaviour use --extract-over-symlinks (Closes: #774669) 4Subject: [PATCH] Fix CVE-2015-1197
5 This issue has been discovered by Alexander Cherepanov. 5
6Apply patch by Vitezslav Cizek of SuSE to fix CVE-2015-1197.
7Upstream is dormant or no longer existing. To restore the old
8behaviour use --extract-over-symlinks (Closes: #774669)
9This issue has been discovered by Alexander Cherepanov.
6Author: Vitezslav Cizek <vcizek@suse.cz> 10Author: Vitezslav Cizek <vcizek@suse.cz>
7Bug-Debian: https://bugs.debian.org/774669 11Bug-Debian: https://bugs.debian.org/774669
8 12
9Upstream-Status: Backport 13Upstream-Status: Pending
10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
16
17---
18 doc/cpio.1 | 1 +
19 src/copyin.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 src/extern.h | 1 +
21 src/global.c | 3 +++
22 src/main.c | 7 +++++++
23 5 files changed, 74 insertions(+)
12 24
13--- cpio-2.11+dfsg.orig/doc/cpio.1 25diff --git a/doc/cpio.1 b/doc/cpio.1
14+++ cpio-2.11+dfsg/doc/cpio.1 26index 2a68241..dc4676c 100644
15@@ -22,6 +22,7 @@ cpio \- copy files to and from archives 27--- a/doc/cpio.1
16 [\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message] 28+++ b/doc/cpio.1
17 [\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse] 29@@ -49,6 +49,7 @@ cpio \- copy files to and from archives
18 [\-\-only\-verify\-crc] [\-\-to\-stdout] [\-\-quiet] [\-\-rsh-command=command] 30 [\fB\-\-no\-preserve\-owner\fR] [\fB\-\-message=\fIMESSAGE\fR]
19+[\-\-extract\-over\-symlinks] 31 [\fB\-\-force\-local\fR] [\fB\-\-no\-absolute\-filenames\fR] [\fB\-\-sparse\fR]
20 [\-\-help] [\-\-version] [pattern...] [< archive] 32 [\fB\-\-only\-verify\-crc\fR] [\fB\-\-to\-stdout\fR] [\fB\-\-quiet\fR]
33+[\fB\-\-extract\-over\-symlinks\fR]
34 [\fB\-\-rsh\-command=\fICOMMAND\fR]
35 [\fIpattern\fR...] [\fB<\fR \fIarchive\fR]
21 36
22 .B cpio 37diff --git a/src/copyin.c b/src/copyin.c
23--- cpio-2.11+dfsg.orig/src/copyin.c 38index cde911e..053afe7 100644
24+++ cpio-2.11+dfsg/src/copyin.c 39--- a/src/copyin.c
25@@ -700,6 +700,51 @@ copyin_link (struct cpio_file_stat *file 40+++ b/src/copyin.c
41@@ -695,6 +695,51 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des)
26 free (link_name); 42 free (link_name);
27 } 43 }
28 44
@@ -74,7 +90,7 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
74 static void 90 static void
75 copyin_file (struct cpio_file_stat *file_hdr, int in_file_des) 91 copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
76 { 92 {
77@@ -1471,6 +1516,23 @@ process_copy_in () 93@@ -1468,6 +1513,23 @@ process_copy_in ()
78 { 94 {
79 /* Copy the input file into the directory structure. */ 95 /* Copy the input file into the directory structure. */
80 96
@@ -98,18 +114,22 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
98 /* Do we need to rename the file? */ 114 /* Do we need to rename the file? */
99 if (rename_flag || rename_batch_file) 115 if (rename_flag || rename_batch_file)
100 { 116 {
101--- cpio-2.11+dfsg.orig/src/extern.h 117diff --git a/src/extern.h b/src/extern.h
102+++ cpio-2.11+dfsg/src/extern.h 118index e27d662..d864bde 100644
103@@ -95,6 +95,7 @@ extern char input_is_special; 119--- a/src/extern.h
120+++ b/src/extern.h
121@@ -96,6 +96,7 @@ extern char input_is_special;
104 extern char output_is_special; 122 extern char output_is_special;
105 extern char input_is_seekable; 123 extern char input_is_seekable;
106 extern char output_is_seekable; 124 extern char output_is_seekable;
107+extern bool extract_over_symlinks; 125+extern bool extract_over_symlinks;
108 extern int (*xstat) (); 126 extern int (*xstat) ();
109 extern void (*copy_function) (); 127 extern void (*copy_function) ();
110 128 extern char *change_directory_option;
111--- cpio-2.11+dfsg.orig/src/global.c 129diff --git a/src/global.c b/src/global.c
112+++ cpio-2.11+dfsg/src/global.c 130index 57e505a..336fce4 100644
131--- a/src/global.c
132+++ b/src/global.c
113@@ -187,6 +187,9 @@ bool to_stdout_option = false; 133@@ -187,6 +187,9 @@ bool to_stdout_option = false;
114 /* The name this program was run with. */ 134 /* The name this program was run with. */
115 char *program_name; 135 char *program_name;
@@ -120,19 +140,19 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
120 /* A pointer to either lstat or stat, depending on whether 140 /* A pointer to either lstat or stat, depending on whether
121 dereferencing of symlinks is done for input files. */ 141 dereferencing of symlinks is done for input files. */
122 int (*xstat) (); 142 int (*xstat) ();
123--- cpio-2.11+dfsg.orig/src/main.c 143diff --git a/src/main.c b/src/main.c
124+++ cpio-2.11+dfsg/src/main.c 144index a13861f..87cb309 100644
125@@ -57,7 +57,8 @@ enum cpio_options { 145--- a/src/main.c
126 FORCE_LOCAL_OPTION, 146+++ b/src/main.c
147@@ -59,6 +59,7 @@ enum cpio_options {
127 DEBUG_OPTION, 148 DEBUG_OPTION,
128 BLOCK_SIZE_OPTION, 149 BLOCK_SIZE_OPTION,
129- TO_STDOUT_OPTION 150 TO_STDOUT_OPTION,
130+ TO_STDOUT_OPTION, 151+ EXTRACT_OVER_SYMLINKS,
131+ EXTRACT_OVER_SYMLINKS 152 RENUMBER_INODES_OPTION,
132 }; 153 IGNORE_DEVNO_OPTION,
133 154 DEVICE_INDEPENDENT_OPTION
134 const char *program_authors[] = 155@@ -243,6 +244,8 @@ static struct argp_option options[] = {
135@@ -222,6 +223,8 @@ static struct argp_option options[] = {
136 N_("Create leading directories where needed"), GRID+1 }, 156 N_("Create leading directories where needed"), GRID+1 },
137 {"no-preserve-owner", NO_PRESERVE_OWNER_OPTION, 0, 0, 157 {"no-preserve-owner", NO_PRESERVE_OWNER_OPTION, 0, 0,
138 N_("Do not change the ownership of the files"), GRID+1 }, 158 N_("Do not change the ownership of the files"), GRID+1 },
@@ -141,14 +161,17 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
141 {"unconditional", 'u', NULL, 0, 161 {"unconditional", 'u', NULL, 0,
142 N_("Replace all files unconditionally"), GRID+1 }, 162 N_("Replace all files unconditionally"), GRID+1 },
143 {"sparse", SPARSE_OPTION, NULL, 0, 163 {"sparse", SPARSE_OPTION, NULL, 0,
144@@ -412,6 +415,10 @@ crc newc odc bin ustar tar (all-caps als 164@@ -432,6 +435,10 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg));
145 no_chown_flag = true; 165 no_chown_flag = true;
146 break; 166 break;
147 167
148+ case EXTRACT_OVER_SYMLINKS: /* --extract-over-symlinks */ 168+ case EXTRACT_OVER_SYMLINKS: /* --extract-over-symlinks */
149+ extract_over_symlinks = true; 169+ extract_over_symlinks = true;
150+ break; 170+ break;
151+ 171+
152 case 'o': /* Copy-out mode. */ 172 case 'o': /* Copy-out mode. */
153 if (copy_function != 0) 173 if (copy_function != 0)
154 error (PAXEXIT_FAILURE, 0, _("Mode already defined")); 174 USAGE_ERROR ((0, 0, _("Mode already defined")));
175--
1762.6.2
177
diff --git a/meta/recipes-extended/cpio/cpio-2.11/0001-Unset-need_charset_alias-when-building-for-musl.patch b/meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch
index 6ae213942c..6ae213942c 100644
--- a/meta/recipes-extended/cpio/cpio-2.11/0001-Unset-need_charset_alias-when-building-for-musl.patch
+++ b/meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch
diff --git a/meta/recipes-extended/cpio/cpio_2.11.bb b/meta/recipes-extended/cpio/cpio_2.11.bb
deleted file mode 100644
index 9a6a50e8b8..0000000000
--- a/meta/recipes-extended/cpio/cpio_2.11.bb
+++ /dev/null
@@ -1,18 +0,0 @@
1include cpio_v2.inc
2
3LICENSE = "GPLv3"
4LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
5
6PR = "r5"
7
8SRC_URI += "file://remove-gets.patch \
9 file://fix-memory-overrun.patch \
10 file://cpio-CVE-2015-1197.patch \
11 file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
12 file://Fix-symlink-bad-length-test-for-64-bit-architectures.patch \
13 file://fix-testcase-symlink-bad-lengths.patch \
14 file://0001-fix-testcase-of-symlink-bad-length.patch \
15 "
16
17SRC_URI[md5sum] = "1112bb6c45863468b5496ba128792f6c"
18SRC_URI[sha256sum] = "601b1d774cd6e4cd39416203c91ec59dbd65dd27d79d75e1a9b89497ea643978"
diff --git a/meta/recipes-extended/cpio/cpio_2.12.bb b/meta/recipes-extended/cpio/cpio_2.12.bb
new file mode 100644
index 0000000000..e7439996bb
--- /dev/null
+++ b/meta/recipes-extended/cpio/cpio_2.12.bb
@@ -0,0 +1,12 @@
1include cpio_v2.inc
2
3LICENSE = "GPLv3"
4LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
5
6SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
7 file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
8 file://0001-Fix-CVE-2015-1197.patch \
9 "
10
11SRC_URI[md5sum] = "fc207561a86b63862eea4b8300313e86"
12SRC_URI[sha256sum] = "08a35e92deb3c85d269a0059a27d4140a9667a6369459299d08c17f713a92e73"
diff --git a/meta/recipes-extended/cpio/cpio_2.8.bb b/meta/recipes-extended/cpio/cpio_2.8.bb
index 3f97dbe2ce..624906b134 100644
--- a/meta/recipes-extended/cpio/cpio_2.8.bb
+++ b/meta/recipes-extended/cpio/cpio_2.8.bb
@@ -5,7 +5,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b7f772ea3a2489231cb4872656cac34b"
5 5
6PR = "r4" 6PR = "r4"
7 7
8SRC_URI += "file://m4extensions.patch \ 8SRC_URI += " \
9 file://statdef.patch \
10 file://m4extensions.patch \
9 file://avoid_heap_overflow.patch \ 11 file://avoid_heap_overflow.patch \
10 file://fix-memory-overrun.patch \ 12 file://fix-memory-overrun.patch \
11 " 13 "
diff --git a/meta/recipes-extended/cpio/cpio_v2.inc b/meta/recipes-extended/cpio/cpio_v2.inc
index 8520ff267c..1bdc6176c4 100644
--- a/meta/recipes-extended/cpio/cpio_v2.inc
+++ b/meta/recipes-extended/cpio/cpio_v2.inc
@@ -7,7 +7,6 @@ SECTION = "base"
7DEPENDS = "texinfo-native" 7DEPENDS = "texinfo-native"
8 8
9SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \ 9SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
10 file://statdef.patch \
11 " 10 "
12 11
13inherit autotools gettext texinfo 12inherit autotools gettext texinfo