Skip to content

Commit

Permalink
Merge pull request #482 from chewing/0.7.0-rc.2-fix
Browse files Browse the repository at this point in the history
0.7.0 release
  • Loading branch information
kanru committed Apr 7, 2024
2 parents 994fdb3 + b59d082 commit b543774
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 73 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21.0)
project(libchewing LANGUAGES C)

set(CMAKE_PROJECT_VERSION 0.7.0~rc.3)
set(CMAKE_PROJECT_VERSION 0.7.0)
set(LIBCHEWING_VERSION ${CMAKE_PROJECT_VERSION})
set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
set(LIBCHEWING_BINARY_VERSION 1.0.0)
Expand Down
42 changes: 13 additions & 29 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "chewing"
description = "The Chewing (酷音) intelligent Zhuyin input method."
license = "LGPL-2.1-or-later"
documentation = "https://docs.rs/chewing"
version = "0.7.0-beta.2"
version = "0.7.0-beta.3"
rust-version = "1.70"
edition = "2021"

Expand Down Expand Up @@ -44,6 +44,9 @@ lto = true
debug = true
panic = "abort"

[package.metadata.vet]
store = { path = "./vet" }

[package.metadata.docs.rs]
features = ["capi", "sqlite"]
# rustdoc-args = ["-Zunstable-options", "--sort-modules-by-appearance"]
23 changes: 13 additions & 10 deletions NEWS
@@ -1,4 +1,4 @@
What's New in libchewing 0.7.0-rc.2 (Mar 31, 2024)
What's New in libchewing 0.7.0 (Apr 7, 2024)
---------------------------------------------------------

This is the first beta release of the Rust rewrite. The library has been tested
Expand All @@ -7,10 +7,9 @@ not crash for normal use. Now we invite power users to daily drive the beta
release in order to find more subtle bugs.

The Rust rewrite is ABI compatiable with previous releases. The most notable
difference with the C version includes a new portable system dictionary format
and two new user dictionary format. Users with existing user phrase dictionary
will be automatically migrated to either a new sqlite3 schema or CDB based
format depending on compile time configuration. Old files will be backed up
difference with the C version includes a new portable dictionary format that can
be used both as system dictionary and user dictionary. Users with existing user
phrase dictionary will be automatically migrated. Old files will be backed up
automatically. With these change we will be able to support dictionary sharing
and loading multiple dictionaries in future releases.

Expand All @@ -23,23 +22,27 @@ and loading multiple dictionaries in future releases.

* Added
- Added Colemak-DH ANSI/Orth layout support
- Replace bespoke RIFF+TLV file format with standard DER format (rust)
- Supporting migrating user dictionary file to new format. (rust)
- Allow creating in memory user dictionary (rust)
- New `chewing-cli` tool can be used to create or inspect dictionary files. (rust)
- New `chewing-cli` tool can dump dictionary as or import from CSV file. (rust)
- Audit dependencies using cargo-vet (rust)

* Changed
- New trie dictionary format now has built-in checksum. (rust)
- Buffer user dictionary changes and flush in background without blocking main
thread (rust)

* Bug fixed
- Some unsigned underflow issue found by afl++ (rust)
- Skip symbol selection if preedit buffer is empty (rust)
- Allow numlock in selection mode (rust)
- Avoid infinite recursion (rust)
- Ensure to return KeyBehavior::Commit when we push to commit buffer
- Adjust selection offset after delete symbols
- Disable trace logging if no logger is enabled
- Should not start selection in English mode
- Ensure to return KeyBehavior::Commit when we push to commit buffer (rust)
- Adjust selection offset after delete symbols (rust)
- Disable trace logging if no logger is enabled (rust)
- Should not start selection in English mode (rust)
- Use offset to select from paginated phrase list (rust)

* Documentation
- Added document for fuzzers (rust)
Expand Down
2 changes: 1 addition & 1 deletion fuzzer/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
afl = "0.15.4"
chewing = { version = "0.7.0-beta.2", path = "..", features = ["capi"] }
chewing = { version = "0.7.0-beta.3", path = "..", features = ["capi"] }
log = "0.4.21"
env_logger = "0.10.0"
xflags = "0.3.2"
8 changes: 4 additions & 4 deletions src/dictionary/trie.rs
Expand Up @@ -319,7 +319,7 @@ impl Dictionary for TrieDictionary {
iter_bail_if_oob!(node.child_begin(), node.child_end(), dict.len());
let leaf_data = &dict[node.child_begin()..];
let leaf = TrieLeafView(&leaf_data[..TrieLeafView::SIZE]);
// iter_bail_if_oob!(leaf.data_begin(), leaf.data_end(), self.data.len());
iter_bail_if_oob!(leaf.data_begin(), leaf.data_end(), data.len());
results.push(make_dict_entry(&syllables, &leaf));
if let Some(second) = child_iter.next() {
next = second;
Expand Down Expand Up @@ -1161,11 +1161,11 @@ impl DictionaryBuilder for TrieDictionaryBuilder {

fn build(&mut self, path: &Path) -> Result<(), BuildDictionaryError> {
let mut tmpname = path.to_path_buf();
let semi_random = SystemTime::now()
let pseudo_random = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map(|du| du.subsec_millis())
.map(|du| du.subsec_micros())
.unwrap_or_default();
tmpname.set_file_name(format!("chewing-{}.dat", semi_random));
tmpname.set_file_name(format!("chewing-{}.dat", pseudo_random));
let database = File::create(&tmpname)?;
let mut writer = BufWriter::new(&database);
self.write(&mut writer)?;
Expand Down
24 changes: 14 additions & 10 deletions src/dictionary/trie_buf.rs
Expand Up @@ -232,24 +232,31 @@ impl TrieBufDictionary {
Ok(())
}

pub(crate) fn sync(&mut self) {
pub(crate) fn sync(&mut self) -> Result<(), DictionaryUpdateError> {
if let Some(join_handle) = self.join_handle.take() {
if self.dirty {
// Cancel this sync if the dictionary is already dirty.
return;
}
if !join_handle.is_finished() {
// Wait until previous sync is finished.
self.join_handle = Some(join_handle);
return;
return Ok(());
}
if let Ok(Ok(trie)) = join_handle.join() {
if self.dirty {
// Cancel this sync if the dictionary is already dirty.
return Ok(());
}
self.trie = Some(trie);
self.btree.clear();
self.graveyard.clear();
} else {
error!("[!] Failed to write updated user dictionary due to error.");
}
} else {
// TODO: reduce reading
if !self.path.as_os_str().is_empty() {
self.trie = Some(TrieDictionary::open(&self.path)?);
}
}
Ok(())
}

pub(crate) fn checkpoint(&mut self) {
Expand Down Expand Up @@ -305,10 +312,7 @@ impl Dictionary for TrieBufDictionary {
}

fn reopen(&mut self) -> Result<(), DictionaryUpdateError> {
if !self.path.as_os_str().is_empty() {
self.trie = Some(TrieDictionary::open(&self.path)?);
}
self.sync();
self.sync()?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testhelper/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
chewing = { version = "0.7.0-beta.2", path = "../..", features = ["capi"] }
chewing = { version = "0.7.0-beta.3", path = "../..", features = ["capi"] }

[features]
sqlite = ["chewing/sqlite"]
4 changes: 2 additions & 2 deletions tools/Cargo.toml
Expand Up @@ -2,10 +2,10 @@
name = "chewing-cli"
description = "Tools of the Chewing (酷音) intelligent Zhuyin input method."
license = "LGPL-2.1-or-later"
version = "0.7.0-beta.2"
version = "0.7.0-beta.3"
edition = "2021"

[dependencies]
anyhow = "1.0.0"
chewing = { version = "0.7.0-beta.2", path = "..", features = ["sqlite"] }
chewing = { version = "0.7.0-beta.3", path = "..", features = ["sqlite"] }
xflags = "0.3.2"
25 changes: 25 additions & 0 deletions supply-chain/audits.toml → vet/audits.toml
Expand Up @@ -22,11 +22,31 @@ user-id = 7551 # Kan-Ru Chen (kanru)
start = "2024-03-26"
end = "2025-03-30"

[[audits.der]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
version = "0.7.9"

[[audits.getrandom]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
delta = "0.2.12 -> 0.2.13"

[[audits.libredox]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
delta = "0.0.1 -> 0.1.3"

[[audits.log]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
delta = "0.4.20 -> 0.4.21"

[[audits.redox_users]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
delta = "0.4.4 -> 0.4.5"

[[audits.xflags]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
Expand All @@ -37,6 +57,11 @@ who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
version = "0.3.2"

[[audits.zeroize]]
who = "Kan-Ru Chen <kanru@kanru.info>"
criteria = "safe-to-deploy"
version = "1.7.0"

[[trusted.aho-corasick]]
criteria = "safe-to-deploy"
user-id = 189 # Andrew Gallant (BurntSushi)
Expand Down
12 changes: 0 additions & 12 deletions supply-chain/config.toml → vet/config.toml
Expand Up @@ -37,10 +37,6 @@ criteria = "safe-to-deploy"
version = "0.2.16"
criteria = "safe-to-deploy"

[[exemptions.bitflags]]
version = "1.3.2"
criteria = "safe-to-deploy"

[[exemptions.directories]]
version = "5.0.1"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -109,18 +105,10 @@ criteria = "safe-to-deploy"
version = "0.3.30"
criteria = "safe-to-deploy"

[[exemptions.redox_syscall]]
version = "0.4.1"
criteria = "safe-to-deploy"

[[exemptions.redox_users]]
version = "0.4.4"
criteria = "safe-to-deploy"

[[exemptions.riff]]
version = "2.0.0"
criteria = "safe-to-deploy"

[[exemptions.rusqlite]]
version = "0.31.0"
criteria = "safe-to-deploy"
Expand Down
12 changes: 10 additions & 2 deletions supply-chain/imports.lock → vet/imports.lock
@@ -1,6 +1,14 @@

# cargo-vet imports lock

[[unpublished.chewing]]
version = "0.7.0-beta.3"
audited_as = "0.7.0-beta.2"

[[unpublished.chewing-cli]]
version = "0.7.0-beta.3"
audited_as = "0.7.0-beta.2"

[[publisher.aho-corasick]]
version = "1.1.3"
when = "2024-03-20"
Expand Down Expand Up @@ -107,8 +115,8 @@ user-login = "mbrubeck"
user-name = "Matt Brubeck"

[[publisher.syn]]
version = "2.0.57"
when = "2024-03-30"
version = "2.0.58"
when = "2024-04-03"
user-id = 3618
user-login = "dtolnay"
user-name = "David Tolnay"
Expand Down

0 comments on commit b543774

Please sign in to comment.