exit (eval);
}
- if (cat == 1 && argc > 1)
- errx(1, "the -c option permits only a single file argument");
+ /*
+ * The UNIX standard requires that `uncompress -c` be able to have multiple file parameters given.
+ */
for (; *argv; ++argv)
switch(style) {
"usage: compress [-cfv] [-b bits] [file ...]\n");
else
(void)fprintf(stderr,
- "usage: uncompress [-cfv] [-b bits] [file ...]\n");
+ "usage: uncompress [-cfv] [file ...]\n");
exit(1);
}
# endif
(unsigned long)MINOR(sbp->st_rdev));
else {
+ /*
+ * UNIX compliance fix: printing filename length for soft links
+ * from arcn->ln_nlen instead of sbp->st_size, which is 0.
+ */
+ off_t nlen;
+ if (arcn->type == PAX_SLK) {
+ nlen = arcn->ln_nlen;
+ } else {
+ nlen = sbp->st_size;
+ }
# ifdef LONG_OFF_T
- (void)fprintf(fp, "%9lu ", sbp->st_size);
+ (void)fprintf(fp, "%9lu ", nlen);
# else
- (void)fprintf(fp, "%9qu ", sbp->st_size);
+ (void)fprintf(fp, "%9qu ", nlen);
# endif
}
arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
#else
arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
+ /* When we have extended header for size, prefer it over hd->size */
+ if (size_x_current) {
+ sscanf(size_x_current, "%lld", &arcn->sb.st_size);
+ }
#endif
arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
if (arcn->sb.st_atimespec.tv_sec == 0) { // Can be set from header
mode_t mode12only;
int term_char=3; /* orignal setting */
term_char=1; /* To pass conformance tests 274, 301 */
+ const char *size_header_name = "size";
+ char size_value[100];
+ bzero(size_value, sizeof(size_value));
/*
* check for those file system types pax cannot store
if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
sizeof(hd->size), term_char)) {
# endif
- paxwarn(1,"File is too long for pax %s",arcn->org_name);
- return(1);
+ /*
+ * Insert an extended header for size=<arcn->sb.st_size> since
+ * octal range of 12 byte string cannot fit > 8GiB files in header.
+ * This fixes Conformance test pax.343
+ */
+ int i;
+ snprintf(size_value, sizeof(size_value), "%lld", arcn->sb.st_size);
+ for (i = 0; i < sizeof(o_option_table)/sizeof(O_OPTION_TYPE); i++) {
+ if (strncasecmp(size_header_name, o_option_table[i].name, o_option_table[i].len) == 0) {
+ size_x = size_value;
+ ext_header_entry[ext_header_inx++] = i;
+ }
+ }
+ generate_pax_ext_header_and_data(arcn, ext_header_inx, &ext_header_entry[0],
+ PAXXTYPE, header_name_x, header_name_x_requested);
}
break;
}