diff options
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 15 |
2 files changed, 21 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 8478c799425..d68f0cbecb3 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,12 @@ +2018-11-13 Karl Berry <karl@freefriends.org> + + * texmfmp.c (FORCE_SOURCE_DATE_set, SOURCE_DATE_EPOCH_set): new static. + (init_start_time, get_date_and_time): initialize them. + (getfilemoddate): use_utc if both vars set. + Original suggestion from Ulrike Fischer, tex-live 3 Nov 2018 23:00:48, + original patch from Akira Kakuto. + (getfilemoddate): also, return nothing if ! kpse_in_name_ok. + 2018-11-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * openclose.c: cleanup for non-ascii file names (w32 only) diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index f6c98b5bb27..3b5e1ddb235 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -2219,6 +2219,9 @@ catch_interrupt (int arg) static boolean start_time_set = false; static time_t start_time = 0; +static boolean SOURCE_DATE_EPOCH_set = false; +static boolean FORCE_SOURCE_DATE_set = false; + void init_start_time() { char *source_date_epoch; unsigned long long epoch; @@ -2239,6 +2242,7 @@ FATAL1 ("invalid epoch-seconds-timezone value for environment variable $SOURCE_D epoch = 32535291599ULL; #endif start_time = epoch; + SOURCE_DATE_EPOCH_set = true; } else #endif /* not onlyTeX */ { @@ -2263,6 +2267,7 @@ get_date_and_time (integer *minutes, integer *day, if (sde_texprim && STREQ (sde_texprim, "1")) { init_start_time (); tmptr = gmtime (&start_time); + FORCE_SOURCE_DATE_set = true; } else #endif /* not onlyTeX */ { @@ -3150,10 +3155,14 @@ void getfilemoddate(integer s) { struct stat file_data; - char *file_name = kpse_find_tex(makecfilename(s)); + const_string orig_name = makecfilename(s); + char *file_name = kpse_find_tex(orig_name); if (file_name == NULL) { return; /* empty string */ } + if (! kpse_in_name_ok(file_name)) { + return; /* no permission */ + } recorder_record_input(file_name); /* get file status */ @@ -3163,8 +3172,8 @@ void getfilemoddate(integer s) if (stat(file_name, &file_data) == 0) { #endif size_t len; - - makepdftime(file_data.st_mtime, time_str, /* utc= */false); + boolean use_utc = FORCE_SOURCE_DATE_set && SOURCE_DATE_EPOCH_set; + makepdftime(file_data.st_mtime, time_str, use_utc); len = strlen(time_str); if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) { poolptr = poolsize; |