Repository: luser/rust-minidump (rust)

Issue:
Actually publish synth-minidump
Apparently all the testing I did had a weird knock-on effect that synth-minidump is now in the lockfile as a dependency of minidump-stackwalk even though it's "only" a dev-dependency and `cargo publish` freaks out. To move the release along I just commented out that dep for the publish and reverted it in the post-release commit. 

In the future we should just actually publish synth-minidump.

Based on the new proposal of https://github.com/rust-lang/rfcs/pull/3243 we should probably rename it to minidump-synth or something so that our "namespacing" is consistent.

Pull request:
rename synth-minidump to minidump-synth to prepare for publish
fixes #496

Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 838e890..89e0e9c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -60,7 +60,7 @@ If you ever introduce a new stream, you should consider adjusting the following.
 Core Functionality / Testing:
 
 * [minidump's stream fuzzing tests](https://github.com/luser/rust-minidump/blob/2001547fcf4aa0f28f52b8b1ab5da9bd99c8ac87/minidump/fuzz/fuzz_targets/parse.rs#L13)
-* [synth-minidump's stream generator](https://github.com/luser/rust-minidump/blob/master/synth-minidump/src/lib.rs#L31) (make it so that we can test the stream)
+* [minidump-synth's stream generator](https://github.com/luser/rust-minidump/blob/master/minidump-synth/src/lib.rs#L31) (make it so that we can test the stream)
     * This will require filling in quite a bit of code!
 * [minidump-stackwalk's raw stream dumper](https://github.com/luser/rust-minidump/blob/master/minidump-stackwalk/src/main.rs#L516) (make it so we can debug the stream)
     * This generally requires implementing a "print" function for it
@@ -75,7 +75,7 @@ Documentation / Reporting:
 
 Wow that's a lot!
 
-Since streams are rarely perfectly unique, you can usually fill in this stuff by basing it (read: copy-pasting) the code for similar streams. For instance, if you're implementing something similar to MemoryList, then CTRL+Fing for "memory_list" in synth-minidump will generally show you what needs to be added.
+Since streams are rarely perfectly unique, you can usually fill in this stuff by basing it (read: copy-pasting) the code for similar streams. For instance, if you're implementing something similar to MemoryList, then CTRL+Fing for "memory_list" in minidump-synth will generally show you what needs to be added.
 
 
 # Adding a New Analysis to minidump-processor/minidump-stackwalk
@@ -112,8 +112,8 @@ Whether you're adding a new feature or fixing a bug, **you should always add a t
 
 Major locations for tests include:
 
-* [minidump parsing unit tests](https://github.com/luser/rust-minidump/blob/2001547fcf4aa0f28f52b8b1ab5da9bd99c8ac87/minidump/src/minidump.rs#L4739) (see the `synth-minidump` section)
-* [minidump-processor integration tests](https://github.com/luser/rust-minidump/blob/master/minidump-processor/tests/test_processor.rs) (see the `synth-minidump` section)
+* [minidump parsing unit tests](https://github.com/luser/rust-minidump/blob/2001547fcf4aa0f28f52b8b1ab5da9bd99c8ac87/minidump/src/minidump.rs#L4739) (see the `minidump-synth` section)
+* [minidump-processor integration tests](https://github.com/luser/rust-minidump/blob/master/minidump-processor/tests/test_processor.rs) (see the `minidump-synth` section)
 * [minidump-stackwalk integration tests](https://github.com/luser/rust-minidump/blob/master/minidump-stackwalk/tests/test-minidump-stackwalk.rs) (see the `insta` section)
 * [breakpad-symbols symbol file parser tests](https://github.com/luser/rust-minidump/blob/2001547fcf4aa0f28f52b8b1ab5da9bd99c8ac87/breakpad-symbols/src/lib.rs#L819)
 * [breakpad-symbols cfi interpreter tests](https://github.com/luser/rust-minidump/blob/master/breakpad-symbols/src/sym_file/walker.rs#L1032)
@@ -133,13 +133,13 @@ fuzzing tests (see the `cargo fuzz` section):
 
 
 
-## synth-minidump: Synthetic Minidumps for Tests
+## minidump-synth: Synthetic Minidumps for Tests
 
-rust-minidump includes a [synthetic minidump generator](synth-minidump) which lets you come up with a high-level description of the contents of a minidump, and then produces an actual minidump binary that we can feed it into the full parser.
+rust-minidump includes a [synthetic minidump generator](minidump-synth) which lets you come up with a high-level description of the contents of a minidump, and then produces an actual minidump binary that we can feed it into the full parser.
 
-This is used throughout the codebase. Being able to use synth-minidump and add things to it is very important! This can in turn involve the test_assembler crate, which we discuss in the next section. Thankfully you don't need to master these systems: there's usually already code/tests for something *similar* which you can copy-paste and tweak. 
+This is used throughout the codebase. Being able to use minidump-synth and add things to it is very important! This can in turn involve the test_assembler crate, which we discuss in the next section. Thankfully you don't need to master these systems: there's usually already code/tests for something *similar* which you can copy-paste and tweak. 
 
-Most streams in the minidump format are "some kind of list", and there are a few common formats for those lists. synth-minidump makes it relatively easy to add streams like that. See: ListStream, ExListStream, and SimpleStream.
+Most streams in the minidump format are "some kind of list", and there are a few common formats for those lists. minidump-synth makes it relatively easy to add streams like that. See: ListStream, ExListStream, and SimpleStream.
 
 If your stream is more complicated you might instead want to model your code off of the more adhoc streams like SystemInfo, Exception, or MiscStream.
 
@@ -147,7 +147,7 @@ It's hard for me to know what exactly to say here... the copy-paste method reall
 
 ------
 
-Example test using synth-minidump (from the minidump crate's unit tests):
+Example test using minidump-synth (from the minidump crate's unit tests):
 
 ```rust ,ignore
 #[test]
diff --git a/Cargo.lock b/Cargo.lock
index ee9ee7b..d7f6404 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -642,10 +642,10 @@ dependencies = [
  "log",
  "memmap2",
  "minidump-common",
+ "minidump-synth",
  "num-traits 0.2.14",
  "range-map",
  "scroll",
- "synth-minidump",
  "test-assembler",
  "thiserror",
  "time 0.3.7",
@@ -678,10 +678,10 @@ dependencies = [
  "log",
  "memmap2",
  "minidump",
+ "minidump-synth",
  "scroll",
  "serde",
  "serde_json",
- "synth-minidump",
  "test-assembler",
  "thiserror",
  "tokio",
@@ -697,13 +697,23 @@ dependencies = [
  "minidump",
  "minidump-common",
  "minidump-processor",
+ "minidump-synth",
  "openssl",
  "simplelog",
- "synth-minidump",
  "test-assembler",
  "tokio",
 ]
 
+[[package]]
+name = "minidump-synth"
+version = "0.10.0"
+dependencies = [
+ "encoding",
+ "minidump-common",
+ "scroll",
+ "test-assembler",
+]
+
 [[package]]
 name = "miniz_oxide"
 version = "0.4.4"
@@ -1200,16 +1210,6 @@ dependencies = [
  "unicode-xid",
 ]
 
-[[package]]
-name = "synth-minidump"
-version = "0.10.0"
-dependencies = [
- "encoding",
- "minidump-common",
- "scroll",
- "test-assembler",
-]
-
 [[package]]
 name = "tempfile"
 version = "3.3.0"
diff --git a/Cargo.toml b/Cargo.toml
index 2570e4d..6f102b7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,6 +5,7 @@ members = [
         "minidump-common",
         "minidump-processor",
         "minidump-stackwalk",
+        "minidump-synth",
 ]
 exclude = [
     "testdata/*",
diff --git a/README.md b/README.md
index 25e0693..72571b8 100644
--- a/README.md
+++ b/README.md
@@ -202,12 +202,12 @@ This is primarily designed for use by minidump-processor.
 
 
 
-## [synth-minidump](synth-minidump)
-
-(currently private to this project)
+## [minidump-synth](minidump-synth)
 
 Provides a simple interface for mocking minidumps for unit tests.
 
+This is basically an internal dev-dependency of rust-minidump that we're publishing only so that `cargo publish` doesn't complain about it. I guess you could use it but we don't recommend it?
+
 
 
 
diff --git a/RELEASES.md b/RELEASES.md
index 70c6fdf..e69b2d1 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -6,6 +6,7 @@ Work on making minidump-common more useful for breakpad clients, as well as gene
 
 Changes:
 
+
 # minidump-common
 
 * CONTEXT_ARM64 / CONTEXT_ARM64_OLD have been modified
@@ -15,6 +16,7 @@ Changes:
     * FLOATING_SAVE_AREA_ARM64 has fixed the order of fpcr/fpsr (was just wrong)
     * ContextFlagsArm64 and ContextFlagsArm64Old have been added
 
+
 # minidump
 
 * MinidumpStream now takes an extra `Option<&MinidumpSystemInfo>` argument so that every stream can have this critical information available while parsing. We will eagerly try to parse this info when you create a Minidump, so if there's any SystemInfo at all (which should always be true, but minidumps are evil), then your stream should have it available for its own parsing. We are currently working on migrating existing streams that need/want it.
@@ -22,6 +24,11 @@ Changes:
 * macOS codeids are now properly handled thanks to the above SystemInfo work.
 
 
+# synth-minidump / minidump-synth
+
+synth-minidump has been renamed to minidump-synth and is now published on crates.io. There's no good reason to do this or use it, but I flaw in `cargo publish` requires the dev-dependencies of binaries (minidump-stackwalk) to be published, so, ok it is!
+
+The rename was done to keep our public naming scheme consistent.
 
 
 
diff --git a/minidump-processor/Cargo.toml b/minidump-processor/Cargo.toml
index e128d9d..e829576 100644
--- a/minidump-processor/Cargo.toml
+++ b/minidump-processor/Cargo.toml
@@ -33,6 +33,6 @@ thiserror = "1.0.30"
 
 [dev-dependencies]
 doc-comment = "0.3.3"
-synth-minidump = { path = "../synth-minidump" }
+minidump-synth = { path = "../minidump-synth" }
 test-assembler = "0.1.6"
 tokio = { version = "1.12.0", features = ["full"] }
diff --git a/minidump-stackwalk/Cargo.toml b/minidump-stackwalk/Cargo.toml
index 6d3aa13..0a5f315 100644
--- a/minidump-stackwalk/Cargo.toml
+++ b/minidump-stackwalk/Cargo.toml
@@ -32,5 +32,5 @@ optional = true
 
 [dev-dependencies]
 insta = "1.13.0"
-synth-minidump = { version = "0.10.0", path = "../synth-minidump" }
+minidump-synth = { version = "0.10.0", path = "../minidump-synth" }
 test-assembler = "0.1.6"
diff --git a/synth-minidump/Cargo.toml b/minidump-synth/Cargo.toml
similarity index 92%
rename from synth-minidump/Cargo.toml
rename to minidump-synth/Cargo.toml
index 36fd536..1c7252e 100644
--- a/synth-minidump/Cargo.toml
+++ b/minidump-synth/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "synth-minidump"
+name = "minidump-synth"
 version = "0.10.0"
 edition = "2021"
 readme = "README.md"
diff --git a/minidump-synth/README.md b/minidump-synth/README.md
new file mode 100644
index 0000000..1188221
--- /dev/null
+++ b/minidump-synth/README.md
@@ -0,0 +1,7 @@
+# minidump-synth
+
+[![crates.io](https://img.shields.io/crates/v/minidump-synth.svg)](https://crates.io/crates/minidump-synth) [![](https://docs.rs/minidump-synth/badge.svg)](https://docs.rs/minidump-synth)
+
+Provides a simple interface for mocking minidumps for unit tests.
+
+This is basically an internal dev-dependency of rust-minidump that we're publishing only so that `cargo publish` doesn't complain about it. I guess you could use it but we don't recommend it?
diff --git a/synth-minidump/src/lib.rs b/minidump-synth/src/lib.rs
similarity index 99%
rename from synth-minidump/src/lib.rs
rename to minidump-synth/src/lib.rs
index 8dc1d3c..b21e377 100644
--- a/synth-minidump/src/lib.rs
+++ b/minidump-synth/src/lib.rs
@@ -1,6 +1,18 @@
 // Copyright 2016 Ted Mielczarek. See the COPYRIGHT
 // file at the top-level directory of this distribution.
 
+//! Synthetic Minidumps for Testing
+//!
+//! This is a hacky mess that intentionally doesn't use minidump-common's layouts
+//! so that we can catch incorrect changes to minidump-common itself. It exists
+//! primarily as an internal dev-dependency of rust-minidump, but is published
+//! for the sake of satisfying cargo-publish.
+//!
+//! Basic usage is to  [SynthMinidump][], use its methods to build up the binary,
+//! and then `finish()` to write the binary to a buffer. Then you can either write
+//! that to disk as an actual minidump file or feed it directly to the minidump
+//! or minidump-processor crate.
+
 // Some test_assembler types do not have Debug, so be a bit more lenient here.
 #![allow(missing_debug_implementations)]
 
diff --git a/minidump/Cargo.toml b/minidump/Cargo.toml
index 54eace3..60dcd7a 100644
--- a/minidump/Cargo.toml
+++ b/minidump/Cargo.toml
@@ -26,7 +26,7 @@ time = { version = "0.3.6", features = ["formatting"] }
 uuid = "0.8"
 
 [dev-dependencies]
-synth-minidump = { path = "../synth-minidump" }
+minidump-synth = { path = "../minidump-synth" }
 test-assembler = "0.1.6"
 doc-comment = "0.3.3"
 
diff --git a/minidump/src/minidump.rs b/minidump/src/minidump.rs
index 81f0330..b3105cf 100644
--- a/minidump/src/minidump.rs
+++ b/minidump/src/minidump.rs
@@ -5028,14 +5028,14 @@ mod test {
     use super::*;
     use md::GUID;
     use minidump_common::format::{PlatformId, ProcessorArchitecture};
-    use std::mem;
-    use synth_minidump::{
+    use minidump_synth::{
         self, AnnotationValue, CrashpadInfo, DumpString, Exception, Memory,
         MemoryInfo as SynthMemoryInfo, MiscFieldsBuildString, MiscFieldsPowerInfo,
         MiscFieldsProcessTimes, MiscFieldsTimeZone, MiscInfo5Fields, MiscStream,
         Module as SynthModule, ModuleCrashpadInfo, SimpleStream, SynthMinidump, SystemInfo, Thread,
         ThreadName, UnloadedModule as SynthUnloadedModule, STOCK_VERSION_INFO,
     };
+    use std::mem;
     use test_assembler::*;
 
     fn read_synth_dump<'a>(dump: SynthMinidump) -> Result<Minidump<'a, Vec<u8>>, Error> {
@@ -6354,7 +6354,7 @@ c70206ca83eb2852-de0206ca83eb2852  -w-s  10bac9000 fd:05 1196511 /usr/lib64/libt
 
     #[test]
     fn test_thread_list_x86() {
-        let context = synth_minidump::x86_context(Endian::Little, 0xabcd1234, 0x1010);
+        let context = minidump_synth::x86_context(Endian::Little, 0xabcd1234, 0x1010);
         let stack = Memory::with_section(
             Section::with_endian(Endian::Little).append_repeated(0, 0x1000),
             0x1000,
@@ -6392,7 +6392,7 @@ c70206ca83eb2852-de0206ca83eb2852  -w-s  10bac9000 fd:05 1196511 /usr/lib64/libt
     #[test]
     fn test_thread_list_amd64() {
         let context =
-            synth_minidump::amd64_context(Endian::Little, 0x1234abcd1234abcd, 0x1000000010000000);
+            minidump_synth::amd64_context(Endian::Little, 0x1234abcd1234abcd, 0x1000000010000000);
         let stack = Memory::with_section(
             Section::with_endian(Endian::Little).append_repeated(0, 0x1000),
             0x1000000010000000,
diff --git a/synth-minidump/README.md b/synth-minidump/README.md
deleted file mode 100644
index a1f7559..0000000
--- a/synth-minidump/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# synth-minidump
-
-[![crates.io](https://img.shields.io/crates/v/synth-minidump.svg)](https://crates.io/crates/synth-minidump) [![](https://docs.rs/synth-minidump/badge.svg)](https://docs.rs/synth-minidump)
-
-Provides a simple interface for mocking minidumps for unit tests.
-
-Currently unpublished, as there is no reason to do so.


Test patch:
diff --git a/minidump-processor/tests/test_processor.rs b/minidump-processor/tests/test_processor.rs
index f4a60ee..31ec4d1 100644
--- a/minidump-processor/tests/test_processor.rs
+++ b/minidump-processor/tests/test_processor.rs
@@ -10,7 +10,7 @@ use minidump_processor::{
 };
 use std::path::{Path, PathBuf};
 
-use synth_minidump::*;
+use minidump_synth::*;
 use test_assembler::*;
 
 fn locate_testdata() -> PathBuf {
@@ -134,7 +134,7 @@ async fn test_processor_symbols() {
 }
 
 fn minimal_minidump() -> SynthMinidump {
-    let context = synth_minidump::x86_context(Endian::Little, 0xabcd1234, 0x1010);
+    let context = minidump_synth::x86_context(Endian::Little, 0xabcd1234, 0x1010);
     let stack = Memory::with_section(
         Section::with_endian(Endian::Little).append_repeated(0, 0x1000),
         0x1000,
@@ -243,7 +243,7 @@ async fn test_linux_proc_status() {
 
 #[tokio::test]
 async fn test_no_frames() {
-    let context = synth_minidump::x86_context(Endian::Little, 0, 0);
+    let context = minidump_synth::x86_context(Endian::Little, 0, 0);
 
     let stack = Memory::with_section(Section::with_endian(Endian::Little), 0);
 
diff --git a/minidump-stackwalk/tests/test-minidump-stackwalk.rs b/minidump-stackwalk/tests/test-minidump-stackwalk.rs
index 2f5fb65..a6bcf6d 100644
--- a/minidump-stackwalk/tests/test-minidump-stackwalk.rs
+++ b/minidump-stackwalk/tests/test-minidump-stackwalk.rs
@@ -15,11 +15,11 @@
 // Also note that `cargo test` for an application adds our binary to
 // the env as `CARGO_BIN_EXE_<name>`.
 
+use minidump_synth::*;
 use std::fs::File;
 use std::io::{BufReader, Read, Write};
 use std::path::PathBuf;
 use std::process::{Command, Stdio};
-use synth_minidump::*;
 use test_assembler::*;
 
 // Some tests need to write files (and read them back).
@@ -621,7 +621,7 @@ fn test_brief_robots() {
 }
 
 fn minimal_minidump() -> SynthMinidump {
-    let context = synth_minidump::x86_context(Endian::Little, 0xf00800, 0x1010);
+    let context = minidump_synth::x86_context(Endian::Little, 0xf00800, 0x1010);
     let stack = Memory::with_section(
         Section::with_endian(Endian::Little).append_repeated(0, 0x1000),
         0x1000,