1 | # Process this file with autom4te to create testsuite. -*- Autotest -*-
|
---|
2 | # Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | # This program is free software; you can redistribute it and/or modify
|
---|
5 | # it under the terms of the GNU General Public License as published by
|
---|
6 | # the Free Software Foundation; either version 3, or (at your option)
|
---|
7 | # any later version.
|
---|
8 |
|
---|
9 | # This program is distributed in the hope that it will be useful,
|
---|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | # GNU General Public License for more details.
|
---|
13 |
|
---|
14 | # You should have received a copy of the GNU General Public License
|
---|
15 | # along with this program; if not, write to the Free Software
|
---|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
---|
17 | # 02110-1301 USA.
|
---|
18 |
|
---|
19 | # Cpio v2.11 did segfault with badly set symlink length.
|
---|
20 | # References:
|
---|
21 | # http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
|
---|
22 |
|
---|
23 | AT_SETUP([symlink-bad-length])
|
---|
24 | AT_KEYWORDS([symlink-long copyout])
|
---|
25 |
|
---|
26 | AT_DATA([ARCHIVE.base64],
|
---|
27 | [x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
|
---|
28 | JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
|
---|
29 | UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
30 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
31 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
32 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
33 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
34 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
35 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
---|
36 | ])
|
---|
37 |
|
---|
38 | # The exact error message and exit status depend on the host architecture,
|
---|
39 | # therefore strderr is filtered out and error code is not checked.
|
---|
40 |
|
---|
41 | # So far the only case when cpio would exit with code 0 is when it skips
|
---|
42 | # several bytes and encounters a valid record header. Perhaps it should
|
---|
43 | # exit with code 2 (non-critical error), if at least one byte was skipped,
|
---|
44 | # but that could hurt backward compatibility.
|
---|
45 |
|
---|
46 | AT_CHECK([
|
---|
47 | base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
|
---|
48 | TZ=UTC cpio -ntv < ARCHIVE 2>stderr
|
---|
49 | cat stderr | grep -v \
|
---|
50 | -e 'stored filename length is out of range' \
|
---|
51 | -e 'premature end of file' \
|
---|
52 | -e 'archive header has reverse byte-order' \
|
---|
53 | -e 'memory exhausted' \
|
---|
54 | -e 'skipped [[0-9][0-9]*] bytes of junk' \
|
---|
55 | -e '[[0-9][0-9]*] block' \
|
---|
56 | >&2
|
---|
57 | echo >&2 STDERR
|
---|
58 | ],
|
---|
59 | [0],
|
---|
60 | [-rw-rw-r-- 1 10029 10031 13 Nov 25 2014 FILE
|
---|
61 | ],[STDERR
|
---|
62 | ])
|
---|
63 |
|
---|
64 | AT_CLEANUP
|
---|