Deleted Added
full compact
test_write_format_gnutar_filenames.c (302408) test_write_format_gnutar_filenames.c (306321)
1/*-
2 * Copyright (c) 2016 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
1/*-
2 * Copyright (c) 2016 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c 302294 2016-06-30 08:51:50Z mm $");
26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c 306321 2016-09-25 22:02:27Z mm $");
27
28/*
29 * Inspired by Github issue #682, which reported that gnutar filenames
30 * of exactly 512 bytes weren't getting written correctly.
31 *
32 * This writes a filename of every length from 1 to 2000 bytes and
33 * reads back to verify it.
34 */

--- 60 unchanged lines hidden (view full) ---

95{
96 size_t buffsize = 1000000;
97 char *buff;
98 struct archive_entry *ae, *template;
99 struct archive *a;
100 size_t used;
101 int i;
102
27
28/*
29 * Inspired by Github issue #682, which reported that gnutar filenames
30 * of exactly 512 bytes weren't getting written correctly.
31 *
32 * This writes a filename of every length from 1 to 2000 bytes and
33 * reads back to verify it.
34 */

--- 60 unchanged lines hidden (view full) ---

95{
96 size_t buffsize = 1000000;
97 char *buff;
98 struct archive_entry *ae, *template;
99 struct archive *a;
100 size_t used;
101 int i;
102
103#ifdef S_IFLNK
104 assertEqualInt(S_IFLNK, AE_IFLNK);
105#endif
106
103 buff = malloc(buffsize); /* million bytes of work area */
104 assert(buff != NULL);
105
106 /* Create a template entry. */
107 assert((template = archive_entry_new()) != NULL);
108 archive_entry_set_atime(template, 2, 20);
109 archive_entry_set_birthtime(template, 3, 30);
110 archive_entry_set_ctime(template, 4, 40);
111 archive_entry_set_mtime(template, 5, 50);
107 buff = malloc(buffsize); /* million bytes of work area */
108 assert(buff != NULL);
109
110 /* Create a template entry. */
111 assert((template = archive_entry_new()) != NULL);
112 archive_entry_set_atime(template, 2, 20);
113 archive_entry_set_birthtime(template, 3, 30);
114 archive_entry_set_ctime(template, 4, 40);
115 archive_entry_set_mtime(template, 5, 50);
112 archive_entry_set_mode(template, S_IFLNK | 0755);
116 archive_entry_set_mode(template, AE_IFLNK | 0755);
113 archive_entry_copy_pathname(template, "link");
114
115 for (i = 0; i < 2000; ++i) {
116 filename[i] = 'a';
117 filename[i + 1] = '\0';
118 archive_entry_copy_symlink(template, filename);
119
120 /* Write a one-item gnutar format archive. */

--- 27 unchanged lines hidden ---
117 archive_entry_copy_pathname(template, "link");
118
119 for (i = 0; i < 2000; ++i) {
120 filename[i] = 'a';
121 filename[i + 1] = '\0';
122 archive_entry_copy_symlink(template, filename);
123
124 /* Write a one-item gnutar format archive. */

--- 27 unchanged lines hidden ---