35
35
/* Regular file with 2 links. */
36
37
assertIsReg("file", 0644);
38
39
assertFileSize("file", 10);
39
41
assertFileNLinks("file", 2);
41
43
/* Another name for the same file. */
42
45
assertIsHardlink("linkfile", "file");
46
49
assertIsSymlink("symlink", "file");
48
51
/* Another file with 1 link and different permissions. */
49
53
assertIsReg("file2", 0777);
50
55
assertFileSize("file2", 10);
51
57
assertFileNLinks("file2", 1);
88
94
/* Verify stderr. */
89
95
failure("Error invoking %s -i %s in dir %s", testprog, unpack_options, target);
90
assertTextFileContents(se, "unpack.err");
96
assertTextFileContents(se2, "unpack.err");
92
98
verify_files(pack_options);
132
139
* Create an assortment of files on disk.
134
141
filelist = fopen("filelist", "w");
142
memset(result, 0, sizeof(result));
136
144
/* File with 10 bytes content. */
137
145
assertMakeFile("file", 0644, "1234567890");
138
146
fprintf(filelist, "file\n");
147
if (is_LargeInode("file"))
149
"bsdcpio: file: large inode number truncated: "
150
"Numerical result out of range\n",
151
sizeof(result) - strlen(result));
140
153
/* hardlink to above file. */
141
154
assertMakeHardlink("linkfile", "file");
142
155
fprintf(filelist, "linkfile\n");
156
if (is_LargeInode("linkfile"))
158
"bsdcpio: linkfile: large inode number truncated: "
159
"Numerical result out of range\n",
160
sizeof(result) - strlen(result));
144
162
/* Symlink to above file. */
145
163
if (canSymlink()) {
146
164
assertMakeSymlink("symlink", "file");
147
165
fprintf(filelist, "symlink\n");
166
if (is_LargeInode("symlink"))
168
"bsdcpio: symlink: large inode number truncated: "
169
"Numerical result out of range\n",
170
sizeof(result) - strlen(result));
150
173
/* Another file with different permissions. */
151
174
assertMakeFile("file2", 0777, "1234567890");
152
175
fprintf(filelist, "file2\n");
176
if (is_LargeInode("file2"))
178
"bsdcpio: file2: large inode number truncated: "
179
"Numerical result out of range\n",
180
sizeof(result) - strlen(result));
155
183
assertMakeDir("dir", 0775);
156
184
fprintf(filelist, "dir\n");
185
if (is_LargeInode("dir"))
187
"bsdcpio: dir: large inode number truncated: "
188
"Numerical result out of range\n",
189
sizeof(result) - strlen(result));
190
strncat(result, "2 blocks\n", sizeof(result) - strlen(result));
158
193
fclose(filelist);
162
197
/* Archive/dearchive with a variety of options. */
163
198
msg = canSymlink() ? "2 blocks\n" : "1 block\n";
164
basic_cpio("copy", "", "", msg);
165
basic_cpio("copy_odc", "--format=odc", "", msg);
166
basic_cpio("copy_newc", "-H newc", "", "2 blocks\n");
167
basic_cpio("copy_cpio", "-H odc", "", msg);
199
basic_cpio("copy", "", "", msg, msg);
200
basic_cpio("copy_odc", "--format=odc", "", msg, msg);
201
basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n");
202
basic_cpio("copy_cpio", "-H odc", "", msg, msg);
168
203
msg = canSymlink() ? "9 blocks\n" : "8 blocks\n";
169
basic_cpio("copy_ustar", "-H ustar", "", msg);
204
basic_cpio("copy_ustar", "-H ustar", "", msg, msg);
171
206
/* Copy in one step using -p */
172
207
passthrough("passthrough");