aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_tar.hrl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-05-22 13:29:24 +0200
committerBjörn Gustavsson <[email protected]>2017-05-29 10:16:03 +0200
commit7fbda5f4bb33776758bf7e3a31d8ee6ee2aa46db (patch)
treeab486d42ea34abed8fd28b1471670453ac018593 /lib/stdlib/src/erl_tar.hrl
parent8404980fda28ca9a8d4e8899736a77c9d09a568d (diff)
downloadotp-7fbda5f4bb33776758bf7e3a31d8ee6ee2aa46db.tar.gz
otp-7fbda5f4bb33776758bf7e3a31d8ee6ee2aa46db.tar.bz2
otp-7fbda5f4bb33776758bf7e3a31d8ee6ee2aa46db.zip
erl_tar: Fix handling of date and time
Since aa0c4b0df7cdc, erl_tar would write the local time (instead of the POSIX time) into the tar header for the archived files. When extracting the tar file, the extracted file could be set to a future time (depending on the time zone). We could do a minimal fix, but this seems to be a good time to rewrite the time handling to use the new features that allow file info to be read and written in the POSIX time format. First reported here: https://github.com/erlang/rebar3/issues/1554
Diffstat (limited to 'lib/stdlib/src/erl_tar.hrl')
-rw-r--r--lib/stdlib/src/erl_tar.hrl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/stdlib/src/erl_tar.hrl b/lib/stdlib/src/erl_tar.hrl
index d646d02989..cff0c2f500 100644
--- a/lib/stdlib/src/erl_tar.hrl
+++ b/lib/stdlib/src/erl_tar.hrl
@@ -55,6 +55,8 @@
{string(), binary()} |
{string(), file:filename()}].
+-type tar_time() :: non_neg_integer().
+
%% The tar header, once fully parsed.
-record(tar_header, {
name = "" :: string(), %% name of header file entry
@@ -62,15 +64,15 @@
uid = 0 :: non_neg_integer(), %% user id of owner
gid = 0 :: non_neg_integer(), %% group id of owner
size = 0 :: non_neg_integer(), %% length in bytes
- mtime :: calendar:datetime(), %% modified time
+ mtime :: tar_time(), %% modified time
typeflag :: char(), %% type of header entry
linkname = "" :: string(), %% target name of link
uname = "" :: string(), %% user name of owner
gname = "" :: string(), %% group name of owner
devmajor = 0 :: non_neg_integer(), %% major number of character or block device
devminor = 0 :: non_neg_integer(), %% minor number of character or block device
- atime :: calendar:datetime(), %% access time
- ctime :: calendar:datetime() %% status change time
+ atime :: tar_time(), %% access time
+ ctime :: tar_time() %% status change time
}).
-type tar_header() :: #tar_header{}.