Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch the engine(s) up to TeXLive 2020.0 #666

Merged
merged 24 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4048ef6
Update xdvipdfmx to the TeXLive 2020.0 reference
pkgw Oct 24, 2020
d47454b
tests/tex-outputs: update PDF outputs for new xdvipdfmx behavior
pkgw Oct 24, 2020
ed456ff
Cargo.toml: update vcpkg in hopes of fixing Windows/vcpkg build
pkgw Oct 24, 2020
5c91b00
tectonic/xdvipdfmx: remove some inappropriate Win32-isms that snuck in
pkgw Oct 24, 2020
08c4250
Update synctex to the TeXLive 2020.0 reference
pkgw Oct 24, 2020
7a158df
Update TECKit to the TeXLive 2020.0 reference
pkgw Oct 24, 2020
dc34298
Update bibtex to the TeXLive 2020.0 reference
pkgw Oct 24, 2020
1449a24
tectonic/dpx-pdfdoc.h: fix values for box type enum
pkgw Oct 25, 2020
c718a6b
tectonic/dpx-pdfximage.c: fix uninitialized value
pkgw Oct 25, 2020
05ea01f
tectonic/dpx-tt_cmap.c: fix mistaken variable name
pkgw Oct 25, 2020
07c7bf3
Add `-Z continue-on-errors` unstable option.
pkgw Oct 25, 2020
4c4e388
Update XeTeX to the TeXLive 2020.0 reference
pkgw Oct 25, 2020
b29c6dd
Update test cases for the engine updates
pkgw Oct 26, 2020
01f2820
tectonic/xetex-XeTeXLayoutInterface.cpp: fix new Harfbuzz include
pkgw Oct 26, 2020
40c432b
xdvipdfmx: attempt to fix new segfault in Arxiv regression suite
pkgw Oct 26, 2020
e6e81ca
Wire in the \creationdate implementation and add a test
pkgw Oct 27, 2020
a4bcd56
tests/tex-outputs.rs: try reenabling the_letter_a on Windows
pkgw Oct 27, 2020
3f43d56
tectonic/xetex-texmfmp.c: work on \filesize and \filedump
pkgw Oct 27, 2020
a0fdaa1
tests: add some basic tests for \filedump and \filesize
pkgw Oct 27, 2020
e3d00e0
Implement the new \filemoddate primitive
pkgw Oct 27, 2020
b318d91
Wire up \filemoddate and add a test
pkgw Oct 27, 2020
cf840ea
dist/azure-ci-cd.yml: disable the Windows/vcpkg build for now
pkgw Oct 27, 2020
0cb9e0b
reference_sources: we are now caught up to TeXLive 2020.0 (r54631)
pkgw Oct 27, 2020
d8dddeb
tectonic/dpx-pkfont.c: warn if we try to kpse_find_glyph
pkgw Oct 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ profile = []
# libz-sys = "^1.0"

[dev-dependencies]
filetime = "^0.2"
futures = "0.1"
headers = "0.2"
hyper = "0.12"
Expand All @@ -87,7 +88,7 @@ tokio = "0.1.22"

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "76a7e9248fb3c57350b559966dcaa2d52a5e4458"
rev = "527c0e04332db88a7906e469dca1d9f0a35726fc"

[package.metadata.vcpkg.target]
x86_64-apple-darwin = { install = ["freetype","harfbuzz[icu,graphite2]"] }
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ fn main() {
.file("tectonic/dpx-mem.c")
.file("tectonic/dpx-mfileio.c")
.file("tectonic/dpx-mpost.c")
.file("tectonic/dpx-mt19937ar.c")
.file("tectonic/dpx-numbers.c")
.file("tectonic/dpx-otl_conf.c")
.file("tectonic/dpx-otl_opt.c")
Expand Down
15 changes: 9 additions & 6 deletions dist/azure-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ parameters:
TARGET: x86_64-apple-darwin
TOOLCHAIN: stable

- name: windows
vmImage: windows-2019
params: {}
vars:
TARGET: x86_64-pc-windows-msvc
TOOLCHAIN: stable-x86_64-pc-windows-msvc
# Temporarily disabled due to vcpkg brokenness that looks like it
# will take a little while to resolve. Tracking issue:
# https://github.com/tectonic-typesetting/tectonic/issues/668
# - name: windows
# vmImage: windows-2019
# params: {}
# vars:
# TARGET: x86_64-pc-windows-msvc
# TOOLCHAIN: stable-x86_64-pc-windows-msvc

- name: crossBuilds
type: object
Expand Down
2 changes: 1 addition & 1 deletion reference_sources
Submodule reference_sources updated 473 files
2 changes: 1 addition & 1 deletion src/bin/tectonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn inner(args: CliOptions, config: PersistentConfig, status: &mut dyn StatusBack
engine
);

status.dump_error_logs(&output);
status.dump_error_logs(&output.data);
}
}
}
Expand Down
43 changes: 25 additions & 18 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@ use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::result::Result as StdResult;
use std::str::FromStr;
use std::time::SystemTime;

use crate::digest::DigestData;
use crate::engines::IoEventBackend;
use crate::errors::{ErrorKind, Result, ResultExt};
use crate::io::{Bundle, InputOrigin, IoProvider, IoSetup, IoSetupBuilder, OpenResult};
use crate::status::StatusBackend;
use crate::unstable_opts::UnstableOptions;
use crate::{ctry, errmsg, tt_error, tt_note, tt_warning};
use crate::{BibtexEngine, Spx2HtmlEngine, TexEngine, TexResult, XdvipdfmxEngine};
use std::result::Result as StdResult;
use crate::{
ctry,
digest::DigestData,
engines::IoEventBackend,
errmsg,
errors::{ErrorKind, Result, ResultExt},
io::{
memory::MemoryFileCollection, Bundle, InputOrigin, IoProvider, IoSetup, IoSetupBuilder,
OpenResult,
},
status::StatusBackend,
tt_error, tt_note, tt_warning,
unstable_opts::UnstableOptions,
BibtexEngine, Spx2HtmlEngine, TexEngine, TexResult, XdvipdfmxEngine,
};

/// Different patterns with which files may have been accessed by the
/// underlying engines. Once a file is marked as ReadThenWritten or
Expand Down Expand Up @@ -845,7 +852,7 @@ impl ProcessingSession {

let mut n_skipped_intermediates = 0;

for (name, contents) in &*self.io.mem.files.borrow() {
for (name, file) in &*self.io.mem.files.borrow() {
if name == self.io.mem.stdout_key() {
continue;
}
Expand Down Expand Up @@ -882,7 +889,7 @@ impl ProcessingSession {
continue;
}

if contents.is_empty() {
if file.data.is_empty() {
status.note_highlighted(
"Not writing ",
&format!("`{}`", sname),
Expand All @@ -892,15 +899,15 @@ impl ProcessingSession {
}

let real_path = root.join(name);
let byte_len = Byte::from_bytes(contents.len() as u128);
let byte_len = Byte::from_bytes(file.data.len() as u128);
status.note_highlighted(
"Writing ",
&format!("`{}`", real_path.to_string_lossy()),
&format!(" ({})", byte_len.get_appropriate_unit(true).to_string()),
);

let mut f = File::create(&real_path)?;
f.write_all(contents)?;
f.write_all(&file.data)?;
summ.got_written_to_disk = true;

if let Some(ref mut mf_dest) = mf_dest_maybe {
Expand Down Expand Up @@ -1009,10 +1016,10 @@ impl ProcessingSession {
.files
.borrow()
.get(&self.tex_aux_path)
.map(|data| {
.map(|file| {
// We used to use aho-corasick crate here, but it was removed to reduce the code
// size.
data.windows(BIBDATA.len()).any(|s| s == BIBDATA)
file.data.windows(BIBDATA.len()).any(|s| s == BIBDATA)
})
.unwrap_or(false)
}
Expand Down Expand Up @@ -1081,7 +1088,7 @@ impl ProcessingSession {

let format_cache = &mut *self.io.format_cache.as_mut().unwrap();

for (name, contents) in &*self.io.mem.files.borrow() {
for (name, file) in &*self.io.mem.files.borrow() {
if name == self.io.mem.stdout_key() {
continue;
}
Expand All @@ -1093,7 +1100,7 @@ impl ProcessingSession {
}

// Note that we intentionally pass 'stem', not 'name'.
ctry!(format_cache.write_format(stem, contents, status); "cannot write format file {}", sname);
ctry!(format_cache.write_format(stem, &file.data, status); "cannot write format file {}", sname);
}

// All done. Clear the memory layer since this was a special preparatory step.
Expand Down Expand Up @@ -1229,7 +1236,7 @@ impl ProcessingSession {
/// This will panic if you there are multiple strong references to the
/// `files` map. This should only happen if you create and keep a clone of
/// the `Rc<>` wrapping it before calling this function.
pub fn into_file_data(self) -> HashMap<OsString, Vec<u8>> {
pub fn into_file_data(self) -> MemoryFileCollection {
Rc::try_unwrap(self.io.mem.files)
.expect("multiple strong refs to MemoryIo files")
.into_inner()
Expand Down
25 changes: 25 additions & 0 deletions src/engines/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,23 @@ impl<'a> ExecutionState<'a> {
}
}

fn input_get_mtime(&mut self, handle: *mut InputHandle) -> libc::time_t {
let rhandle: &mut InputHandle = unsafe { &mut *handle };
let maybe_time = match rhandle.get_unix_mtime() {
Ok(t) => t,
Err(e) => {
tt_warning!(self.status, "failed to get the modification time of an input"; e);
Some(0)
}
};

if let Some(t) = maybe_time {
t as libc::time_t
} else {
1 // Intentionally make this distinguishable from the error value 0
}
}

fn input_seek(&mut self, handle: *mut InputHandle, pos: SeekFrom) -> Result<u64> {
let rhandle: &mut InputHandle = unsafe { &mut *handle };
rhandle.try_seek(pos)
Expand Down Expand Up @@ -697,6 +714,14 @@ pub extern "C" fn input_get_size(
es.input_get_size(handle)
}

#[no_mangle]
pub extern "C" fn input_get_mtime(
es: &mut ExecutionState,
handle: *mut InputHandle,
) -> libc::time_t {
es.input_get_mtime(handle)
}

#[no_mangle]
pub extern "C" fn input_seek(
es: &mut ExecutionState,
Expand Down
8 changes: 7 additions & 1 deletion src/engines/tex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,16 @@ impl TexEngine {
unsafe {
super::tt_xetex_set_int_variable(b"shell_escape_enabled\0".as_ptr() as _, v);
}
let v = if self.halt_on_error { 1 } else { 0 };

let mut halt_on_error = self.halt_on_error;
if unstables.continue_on_errors {
halt_on_error = false; // command-line override
}
let v = if halt_on_error { 1 } else { 0 };
unsafe {
super::tt_xetex_set_int_variable(b"halt_on_error_p\0".as_ptr() as _, v);
}

let v = if self.initex_mode { 1 } else { 0 };
unsafe {
super::tt_xetex_set_int_variable(b"in_initex_mode\0".as_ptr() as _, v);
Expand Down
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ error_chain! {
Reqwest(reqwest::Error);
ConfigRead(ReadError);
ConfigWrite(WriteError);
Time(std::time::SystemTimeError);
Utf8(str::Utf8Error);
Xdv(tectonic_xdv::XdvError);
Zip(ZipError);
Expand Down
15 changes: 15 additions & 0 deletions src/io/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ impl InputFeatures for File {
Ok(self.metadata()?.len() as usize)
}

fn get_unix_mtime(&mut self) -> Result<Option<i64>> {
let sys_time = self.metadata()?.modified()?;

// No cleaner way to convert a SystemTime to time_t, as far as I can
// tell.
let dur = sys_time.duration_since(std::time::SystemTime::UNIX_EPOCH)?;
Ok(Some(dur.as_secs() as i64))
}

fn try_seek(&mut self, pos: SeekFrom) -> Result<u64> {
Ok(self.seek(pos)?)
}
Expand All @@ -171,6 +180,12 @@ impl InputFeatures for BufReader<File> {
Ok(self.get_mut().metadata()?.len() as usize)
}

fn get_unix_mtime(&mut self) -> Result<Option<i64>> {
let sys_time = self.get_mut().metadata()?.modified()?;
let dur = sys_time.duration_since(std::time::SystemTime::UNIX_EPOCH)?;
Ok(Some(dur.as_secs() as i64))
}

fn try_seek(&mut self, pos: SeekFrom) -> Result<u64> {
Ok(self.seek(pos)?)
}
Expand Down
Loading