summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-24 12:35:35 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-24 13:46:05 +0200
commit30fbd496a1793b4374873144432f9b7a996a689d (patch)
tree3112554b3c51501ca78b417569003b9f5a065fa0
parent802b43c95ab4d6e44e17d6b81931e0963182c262 (diff)
cleanup: remove atime/ctime processing code
This commit removes all the code for parsing and processing atime/ctime and values and related test code. Caring about those is kind of pointless because squashfs can only store mtime in inodes. The only relevant place is when generating a struct stat from a squashfs inode or an fstree node. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/fstree/fstree.c2
-rw-r--r--lib/fstree/fstree_from_file.c2
-rw-r--r--lib/sqfs/deserialize_fstree.c2
-rw-r--r--lib/tar/internal.h2
-rw-r--r--lib/tar/read_header.c62
-rw-r--r--tar/tar2sqfs.c2
-rw-r--r--tests/fstree_init.c4
-rw-r--r--tests/tar_gnu.c14
-rw-r--r--tests/tar_pax.c12
-rw-r--r--tests/tar_ustar.c14
-rw-r--r--tests/tar_xattr_bsd.c2
-rw-r--r--tests/tar_xattr_schily.c2
12 files changed, 0 insertions, 120 deletions
diff --git a/lib/fstree/fstree.c b/lib/fstree/fstree.c
index 11a1dd1..1bbb678 100644
--- a/lib/fstree/fstree.c
+++ b/lib/fstree/fstree.c
@@ -69,8 +69,6 @@ static int process_defaults(struct stat *sb, char *subopts)
if (lval > 0xFFFFFFFFL)
goto fail_ov;
sb->st_mtime = lval;
- sb->st_atime = lval;
- sb->st_ctime = lval;
break;
default:
fprintf(stderr, "Unknown option '%s'\n", value);
diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c
index 74d79ae..46926ee 100644
--- a/lib/fstree/fstree_from_file.c
+++ b/lib/fstree/fstree_from_file.c
@@ -125,8 +125,6 @@ static int handle_line(fstree_t *fs, const char *filename,
memset(&sb, 0, sizeof(sb));
sb.st_mtime = fs->defaults.st_mtime;
- sb.st_atime = fs->defaults.st_atime;
- sb.st_ctime = fs->defaults.st_ctime;
/* isolate keyword */
for (i = 0; isalpha(line[i]); ++i)
diff --git a/lib/sqfs/deserialize_fstree.c b/lib/sqfs/deserialize_fstree.c
index 98444ac..8ed6314 100644
--- a/lib/sqfs/deserialize_fstree.c
+++ b/lib/sqfs/deserialize_fstree.c
@@ -168,8 +168,6 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
out->defaults.st_gid = 0;
out->defaults.st_mode = 0755;
out->defaults.st_mtime = super->modification_time;
- out->defaults.st_ctime = super->modification_time;
- out->defaults.st_atime = super->modification_time;
out->root = tree_node_from_inode(root, &idtbl, "", super->block_size);
free(root);
diff --git a/lib/tar/internal.h b/lib/tar/internal.h
index 8a3a9c5..6ac8d99 100644
--- a/lib/tar/internal.h
+++ b/lib/tar/internal.h
@@ -21,9 +21,7 @@ enum {
PAX_DEV_MIN = 0x010,
PAX_NAME = 0x020,
PAX_SLINK_TARGET = 0x040,
- PAX_ATIME = 0x080,
PAX_MTIME = 0x100,
- PAX_CTIME = 0x200,
PAX_SPARSE_SIZE = 0x400,
};
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 4843bb5..043b5ff 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -125,17 +125,6 @@ static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
if (out->link_target == NULL)
goto fail_errno;
*set_by_pax |= PAX_SLINK_TARGET;
- } else if (!strncmp(line, "atime=", 6)) {
- if (line[6] == '-') {
- if (pax_read_decimal(line + 7, &field))
- goto fail;
- out->sb.st_atime = -((int64_t)field);
- } else {
- if (pax_read_decimal(line + 6, &field))
- goto fail;
- out->sb.st_atime = field;
- }
- *set_by_pax |= PAX_ATIME;
} else if (!strncmp(line, "mtime=", 6)) {
if (line[6] == '-') {
if (pax_read_decimal(line + 7, &field))
@@ -147,17 +136,6 @@ static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
out->sb.st_mtime = field;
}
*set_by_pax |= PAX_MTIME;
- } else if (!strncmp(line, "ctime=", 6)) {
- if (line[6] == '-') {
- if (pax_read_decimal(line + 7, &field))
- goto fail;
- out->sb.st_ctime = -((int64_t)field);
- } else {
- if (pax_read_decimal(line + 6, &field))
- goto fail;
- out->sb.st_ctime = field;
- }
- *set_by_pax |= PAX_CTIME;
} else if (!strncmp(line, "GNU.sparse.name=", 16)) {
free(out->name);
out->name = strdup(line + 5);
@@ -312,46 +290,6 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
}
}
- if (!(set_by_pax & PAX_ATIME)) {
- field = out->sb.st_mtime;
-
- if (version == ETV_PRE_POSIX &&
- ((uint8_t)hdr->tail.gnu.atime[0] == 0x80 ||
- (uint8_t)hdr->tail.gnu.atime[0] == 0xFF ||
- isdigit(hdr->tail.gnu.atime[0]))) {
- if (read_number(hdr->tail.gnu.atime,
- sizeof(hdr->tail.gnu.atime), &field))
- return -1;
- }
-
- if (field & 0x8000000000000000UL) {
- field = ~field + 1;
- out->sb.st_atime = -((int64_t)field);
- } else {
- out->sb.st_atime = field;
- }
- }
-
- if (!(set_by_pax & PAX_CTIME)) {
- field = out->sb.st_mtime;
-
- if (version == ETV_PRE_POSIX &&
- ((uint8_t)hdr->tail.gnu.ctime[0] == 0x80 ||
- (uint8_t)hdr->tail.gnu.ctime[0] == 0xFF ||
- isdigit(hdr->tail.gnu.ctime[0]))) {
- if (read_number(hdr->tail.gnu.ctime,
- sizeof(hdr->tail.gnu.atime), &field))
- return -1;
- }
-
- if (field & 0x8000000000000000UL) {
- field = ~field + 1;
- out->sb.st_ctime = -((int64_t)field);
- } else {
- out->sb.st_ctime = field;
- }
- }
-
if (read_octal(hdr->mode, sizeof(hdr->mode), &field))
return -1;
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 03ae811..625cec6 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -245,8 +245,6 @@ static int create_node_and_repack_data(tar_header_decoded_t *hdr, fstree_t *fs,
if (!keep_time) {
hdr->sb.st_mtime = fs->defaults.st_mtime;
- hdr->sb.st_ctime = fs->defaults.st_ctime;
- hdr->sb.st_atime = fs->defaults.st_atime;
}
node = fstree_add_generic(fs, hdr->name, &hdr->sb, hdr->link_target);
diff --git a/tests/fstree_init.c b/tests/fstree_init.c
index 79033e0..a9428e4 100644
--- a/tests/fstree_init.c
+++ b/tests/fstree_init.c
@@ -18,8 +18,6 @@ int main(void)
assert(fstree_init(&fs, 512, str) == 0);
free(str);
assert(fs.defaults.st_mtime == 1337);
- assert(fs.defaults.st_atime == 1337);
- assert(fs.defaults.st_ctime == 1337);
assert(fs.defaults.st_uid == 1000);
assert(fs.defaults.st_gid == 100);
assert(fs.defaults.st_mode == (S_IFDIR | 0321));
@@ -27,8 +25,6 @@ int main(void)
assert(fstree_init(&fs, 512, NULL) == 0);
assert(fs.defaults.st_mtime == 0);
- assert(fs.defaults.st_atime == 0);
- assert(fs.defaults.st_ctime == 0);
assert(fs.defaults.st_uid == 0);
assert(fs.defaults.st_gid == 0);
assert(fs.defaults.st_mode == (S_IFDIR | 0755));
diff --git a/tests/tar_gnu.c b/tests/tar_gnu.c
index 3f57cee..c5f8ddb 100644
--- a/tests/tar_gnu.c
+++ b/tests/tar_gnu.c
@@ -48,8 +48,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542905892);
- assert(hdr.sb.st_atime == 1542905892);
- assert(hdr.sb.st_ctime == 1542905892);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);
@@ -65,8 +63,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 013375560044);
- assert(hdr.sb.st_atime == 013375561762);
- assert(hdr.sb.st_ctime == 013375561750);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data1", fd, buffer, 5) == 0);
@@ -82,8 +78,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 8589934592);
assert(hdr.sb.st_mtime == 013375730126);
- assert(hdr.sb.st_atime == 013375730126);
- assert(hdr.sb.st_ctime == 013375730126);
assert(strcmp(hdr.name, "big-file.bin") == 0);
assert(!hdr.unknown_record);
clear_header(&hdr);
@@ -96,8 +90,6 @@ int main(void)
assert(hdr.sb.st_gid == 0x80000000);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 013376036700);
- assert(hdr.sb.st_atime == 013376036700);
- assert(hdr.sb.st_ctime == 013376036700);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data2", fd, buffer, 5) == 0);
@@ -113,8 +105,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 8589934592);
- assert(hdr.sb.st_atime == 8589934592);
- assert(hdr.sb.st_ctime == 8589934592);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data3", fd, buffer, 5) == 0);
@@ -130,8 +120,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == -315622800);
- assert(hdr.sb.st_atime == -315622800);
- assert(hdr.sb.st_ctime == -315622800);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data4", fd, buffer, 5) == 0);
@@ -147,8 +135,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542909670);
- assert(hdr.sb.st_atime == 1542909670);
- assert(hdr.sb.st_ctime == 1542909670);
assert(strcmp(hdr.name, filename) == 0);
assert(!hdr.unknown_record);
assert(read_data("data5", fd, buffer, 5) == 0);
diff --git a/tests/tar_pax.c b/tests/tar_pax.c
index f0f664b..c383427 100644
--- a/tests/tar_pax.c
+++ b/tests/tar_pax.c
@@ -48,8 +48,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542905892);
- assert(hdr.sb.st_atime == 1542905911);
- assert(hdr.sb.st_ctime == 1542905892);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);
@@ -65,8 +63,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 8589934592);
assert(hdr.sb.st_mtime == 1542959190);
- assert(hdr.sb.st_atime == 1542959522);
- assert(hdr.sb.st_ctime == 1542959190);
assert(strcmp(hdr.name, "big-file.bin") == 0);
assert(!hdr.unknown_record);
clear_header(&hdr);
@@ -79,8 +75,6 @@ int main(void)
assert(hdr.sb.st_gid == 2147483648);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 013376036700);
- assert(hdr.sb.st_atime == 1542999264);
- assert(hdr.sb.st_ctime == 1542999260);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data1", fd, buffer, 5) == 0);
@@ -96,8 +90,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 8589934592);
- assert(hdr.sb.st_atime == 1543015522);
- assert(hdr.sb.st_ctime == 1543015033);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data2", fd, buffer, 5) == 0);
@@ -113,8 +105,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == -315622800);
- assert(hdr.sb.st_atime == -315622800);
- assert(hdr.sb.st_ctime == 1543015908);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data3", fd, buffer, 5) == 0);
@@ -130,8 +120,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542909670);
- assert(hdr.sb.st_atime == 1542909708);
- assert(hdr.sb.st_ctime == 1542909670);
assert(strcmp(hdr.name, filename) == 0);
assert(!hdr.unknown_record);
assert(read_data("data4", fd, buffer, 5) == 0);
diff --git a/tests/tar_ustar.c b/tests/tar_ustar.c
index 187128a..d497b15 100644
--- a/tests/tar_ustar.c
+++ b/tests/tar_ustar.c
@@ -48,8 +48,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542905892);
- assert(hdr.sb.st_atime == 1542905892);
- assert(hdr.sb.st_ctime == 1542905892);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);
@@ -65,8 +63,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542905892);
- assert(hdr.sb.st_atime == 1542905892);
- assert(hdr.sb.st_ctime == 1542905892);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data1", fd, buffer, 5) == 0);
@@ -82,8 +78,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542905892);
- assert(hdr.sb.st_atime == 1542905892);
- assert(hdr.sb.st_ctime == 1542905892);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data2", fd, buffer, 5) == 0);
@@ -99,8 +93,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 8589934592);
assert(hdr.sb.st_mtime == 013375730126);
- assert(hdr.sb.st_atime == 013375730126);
- assert(hdr.sb.st_ctime == 013375730126);
assert(strcmp(hdr.name, "big-file.bin") == 0);
assert(!hdr.unknown_record);
clear_header(&hdr);
@@ -113,8 +105,6 @@ int main(void)
assert(hdr.sb.st_gid == 8388608);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 013376036700);
- assert(hdr.sb.st_atime == 013376036700);
- assert(hdr.sb.st_ctime == 013376036700);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data3", fd, buffer, 5) == 0);
@@ -130,8 +120,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 8589934592);
- assert(hdr.sb.st_atime == 8589934592);
- assert(hdr.sb.st_ctime == 8589934592);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data4", fd, buffer, 5) == 0);
@@ -147,8 +135,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1542909670);
- assert(hdr.sb.st_atime == 1542909670);
- assert(hdr.sb.st_ctime == 1542909670);
assert(strcmp(hdr.name, filename) == 0);
assert(!hdr.unknown_record);
assert(read_data("data5", fd, buffer, 5) == 0);
diff --git a/tests/tar_xattr_bsd.c b/tests/tar_xattr_bsd.c
index 9bb6d85..360448f 100644
--- a/tests/tar_xattr_bsd.c
+++ b/tests/tar_xattr_bsd.c
@@ -43,8 +43,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1543094477);
- assert(hdr.sb.st_atime == 1543094642);
- assert(hdr.sb.st_ctime == 1543094606);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);
diff --git a/tests/tar_xattr_schily.c b/tests/tar_xattr_schily.c
index c8b85c8..e49bdd9 100644
--- a/tests/tar_xattr_schily.c
+++ b/tests/tar_xattr_schily.c
@@ -43,8 +43,6 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1543094477);
- assert(hdr.sb.st_atime == 1543094642);
- assert(hdr.sb.st_ctime == 1543094606);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);