bugreport-0.5.0/.cargo_vcs_info.json0000644000000001360000000000100130470ustar { "git": { "sha1": "91c38457fba4c71cbfb997c5f15aeeb48f0c4fbb" }, "path_in_vcs": "" }bugreport-0.5.0/.github/workflows/ci.yml000064400000000000000000000111250072674642500164020ustar 00000000000000on: workflow_dispatch: pull_request: push: branches: - master tags: - '*' name: Build jobs: check: name: Check runs-on: ubuntu-latest strategy: matrix: rust: - stable - 1.43.0 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.rust }} override: true - uses: actions-rs/cargo@v1 name: "cargo check" with: command: check test: name: Test Suite runs-on: ubuntu-latest strategy: matrix: rust: - stable - 1.43.0 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.rust }} override: true - uses: actions-rs/cargo@v1 name: "cargo test" with: command: test - uses: actions-rs/cargo@v1 name: "cargo test (no default features)" with: command: test args: --tests --no-default-features - uses: actions-rs/cargo@v1 name: "cargo test (all features)" with: command: test args: --all-features run: name: Run examples strategy: fail-fast: false matrix: job: # Ubuntu 20.04 - { os: ubuntu-20.04 , target: x86_64-unknown-linux-gnu , use-cross: false } - { os: ubuntu-20.04 , target: x86_64-unknown-linux-musl , use-cross: true } - { os: ubuntu-20.04 , target: arm-unknown-linux-gnueabihf , use-cross: true } - { os: ubuntu-20.04 , target: aarch64-unknown-linux-gnu , use-cross: true } - { os: ubuntu-20.04 , target: i586-unknown-linux-gnu , use-cross: true } - { os: ubuntu-20.04 , target: i686-unknown-linux-gnu , use-cross: true } - { os: ubuntu-20.04 , target: i686-unknown-linux-musl , use-cross: true } # Older Ubuntu versions - { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu , use-cross: false } # MacOS - { os: macos-10.15 , target: x86_64-apple-darwin , use-cross: false } # Windows - { os: windows-2019 , target: i686-pc-windows-msvc , use-cross: false } - { os: windows-2019 , target: x86_64-pc-windows-gnu , use-cross: false } - { os: windows-2019 , target: x86_64-pc-windows-msvc , use-cross: false } runs-on: ${{ matrix.job.os }} steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable target: ${{ matrix.job.target }} override: true - uses: actions-rs/cargo@v1 name: "example 'readme'" env: SIMPLE_VAR_1: "'test value' in environment variable" with: use-cross: ${{ matrix.job.use-cross }} command: run args: --target ${{ matrix.job.target }} --example=readme -- "'test value' on command line" "two" "three" - uses: actions-rs/cargo@v1 name: "example 'simple'" env: SIMPLE_VAR_1: "'test value' in environment variable" with: use-cross: ${{ matrix.job.use-cross }} command: run args: --target ${{ matrix.job.target }} --example=simple -- "'test value' on command line" "two" "three" - uses: actions-rs/cargo@v1 name: "example 'custom_collector'" with: use-cross: ${{ matrix.job.use-cross }} command: run args: --target ${{ matrix.job.target }} --example=custom_collector -- "'test value' on command line" "two" "three" - name: "test-crates tests" run: ./test-crates/run-all-tests.sh fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: 1.43.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 name: "cargo fmt" with: command: fmt args: --all -- --check clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: 1.43.0 override: true - run: rustup component add clippy - uses: actions-rs/cargo@v1 name: "cargo clippy" with: command: clippy args: -- -D warnings bugreport-0.5.0/.gitignore000064400000000000000000000000230072674642500136520ustar 00000000000000/target Cargo.lock bugreport-0.5.0/Cargo.lock0000644000000137100000000000100110240ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "ansi_term" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bugreport" version = "0.5.0" dependencies = [ "git-version", "pretty_assertions", "shell-escape", "sys-info", "tempfile", ] [[package]] name = "cc" version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ctor" version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ "quote", "syn", ] [[package]] name = "diff" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" [[package]] name = "fastrand" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] [[package]] name = "git-version" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2" dependencies = [ "git-version-macro", "proc-macro-hack", ] [[package]] name = "git-version-macro" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657" dependencies = [ "proc-macro-hack", "proc-macro2", "quote", "syn", ] [[package]] name = "instant" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] [[package]] name = "libc" version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" [[package]] name = "output_vt100" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ "winapi", ] [[package]] name = "pretty_assertions" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c038cb5319b9c704bf9c227c261d275bfec0ad438118a2787ce47944fb228b" dependencies = [ "ansi_term", "ctor", "diff", "output_vt100", ] [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] name = "quote" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ "winapi", ] [[package]] name = "shell-escape" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" [[package]] name = "syn" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] [[package]] name = "sys-info" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33fcecee49339531cf6bd84ecf3ed94f9c8ef4a7e700f2a1cac9cc1ca485383a" dependencies = [ "cc", "libc", ] [[package]] name = "tempfile" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", "winapi", ] [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" bugreport-0.5.0/Cargo.toml0000644000000025170000000000100110520ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "bugreport" version = "0.5.0" authors = ["David Peter "] description = "Collect system and environment information for bug reports" homepage = "https://github.com/sharkdp/bugreport" keywords = ["bugreport", "diagnostics", "cross-platform", "cli", "terminal"] categories = ["command-line-interface"] license = "MIT/Apache-2.0" repository = "https://github.com/sharkdp/bugreport" [dependencies.git-version] version = "0.3" optional = true [dependencies.shell-escape] version = "0.1" [dependencies.sys-info] version = "0.9" optional = true [dev-dependencies.pretty_assertions] version = "1.1.0" [dev-dependencies.tempfile] version = "3.3.0" [features] collector_operating_system = ["sys-info"] default = ["collector_operating_system", "git_hash", "format_markdown"] format_markdown = [] format_plaintext = [] git_hash = ["git-version"] bugreport-0.5.0/Cargo.toml.orig000064400000000000000000000015310072674642500145560ustar 00000000000000[package] name = "bugreport" description = "Collect system and environment information for bug reports" categories = ["command-line-interface"] homepage = "https://github.com/sharkdp/bugreport" repository = "https://github.com/sharkdp/bugreport" keywords = [ "bugreport", "diagnostics", "cross-platform", "cli", "terminal" ] license = "MIT/Apache-2.0" authors = ["David Peter "] edition = "2018" version = "0.5.0" [features] default = ["collector_operating_system", "git_hash", "format_markdown"] collector_operating_system = ["sys-info"] git_hash = ["git-version"] format_markdown = [] format_plaintext = [] [dependencies] sys-info = { version = "0.9", optional = true } git-version = { version = "0.3", optional = true } shell-escape = "0.1" [dev-dependencies] pretty_assertions = "1.1.0" tempfile = "3.3.0" bugreport-0.5.0/LICENSE-APACHE000064400000000000000000000261350072674642500136220ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. bugreport-0.5.0/LICENSE-MIT000064400000000000000000000017770072674642500133370ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. bugreport-0.5.0/README.md000064400000000000000000000047240072674642500131550ustar 00000000000000# bugreport [![Continuous integration](https://github.com/sharkdp/bugreport/workflows/Build/badge.svg)](https://github.com/sharkdp/bugreport/actions) [![Crates.io](https://img.shields.io/crates/v/bugreport.svg)](https://crates.io/crates/bugreport) [![Documentation](https://docs.rs/bugreport/badge.svg)](https://docs.rs/bugreport) `bugreport` is a Rust library that helps application developers to automatically collect information about the system and the environment that users can send along with a bug report (similar to `git bugreport` or `ffmpeg … -report`). **Note**: This library is in an early stage and the API may change in the future. ## Example The following code ```rust use bugreport::{bugreport, collector::*, format::Markdown}; fn main() { bugreport!() .info(SoftwareVersion::default()) .info(OperatingSystem::default()) .info(CommandLine::default()) .info(EnvironmentVariables::list(&["SHELL", "EDITOR"])) .info(CommandOutput::new("Python version", "python", &["-V"])) .info(CompileTimeInformation::default()) .print::(); } ``` generates bug report information that [looks like this](example-report.md). ## Collectors - [x] Crate information (name, version, git hash) - [x] Operating system (type, name, version) - [x] Command line (including all arguments) - [x] Environment variables (e.g. `SHELL`, `PATH`, …) - [x] File contents (e.g. config files) - [x] Directory contents - [x] Command output (e.g. `bash --version`) - [x] Compile time information (profile, target, architecture, cpu features, etc.) - [ ] Current working directory - [ ] Date and time - [x] User defined collectors ## Features - [x] Markdown export - [ ] Open report output in editor (instead of printing to stdout, see `git bugreport`) - [ ] Ask user for permission to gather information? - [ ] Automatic anonymization of information? (e.g.: remove `/home/username` from paths) - [ ] JSON export (?) ## Use cases / prior art - `ffmpeg`s `-report` option - Interesting: "Setting the environment variable FFREPORT to any value has the same effect." - see also: https://ffmpeg.org/bugreports.html - `git bugreport` - https://git-scm.com/docs/git-bugreport - git version --build-options - `grails bugreport` - http://docs.grails.org/3.1.1/ref/Command%20Line/bug-report.html # Related crates Other crates that might be useful: - [`human-panic`](https://crates.io/crates/human-panic) - Make panic messages nice for humans to read. bugreport-0.5.0/build.rs000064400000000000000000000010750072674642500133370ustar 00000000000000fn main() { // Re-export variables that are only available at build.rs-time, but not // at compile time. for var in &[ "PROFILE", "TARGET", "CARGO_CFG_TARGET_FAMILY", "CARGO_CFG_TARGET_OS", "CARGO_CFG_TARGET_ARCH", "CARGO_CFG_TARGET_POINTER_WIDTH", "CARGO_CFG_TARGET_ENDIAN", "CARGO_CFG_TARGET_FEATURE", "HOST", ] { println!( "cargo:rustc-env=BUGREPORT_{}={}", var, std::env::var(var).unwrap_or_else(|_| "unknown".into()) ); } } bugreport-0.5.0/example-report.md000064400000000000000000000011130072674642500151510ustar 00000000000000#### Software version bugreport 0.4.0 (4687617) #### Operating system Linux 5.11.14-arch1-1 #### Command-line ```bash /home/shark/.cargo-target/debug/examples/readme '"test value" on command line' two three ``` #### Environment variables ```bash SHELL=/usr/bin/zsh EDITOR=vim ``` #### Python version ``` > python -V Python 3.9.3 ``` #### Compile time information - Profile: debug - Target triple: x86_64-unknown-linux-gnu - Family: unix - OS: linux - Architecture: x86_64 - Pointer width: 64 - Endian: little - CPU features: fxsr,sse,sse2 - Host: x86_64-unknown-linux-gnu bugreport-0.5.0/examples/custom_collector.rs000064400000000000000000000010150072674642500174300ustar 00000000000000use std::result::Result; use bugreport::{bugreport, collector::*, format::Markdown, report::ReportEntry, CrateInfo}; struct MyCollector {} impl Collector for MyCollector { fn description(&self) -> &str { "My collector" } fn collect(&mut self, _: &CrateInfo) -> Result { Ok(ReportEntry::Text("custom information".into())) } } fn main() { bugreport!() .info(SoftwareVersion::default()) .info(MyCollector {}) .print::(); } bugreport-0.5.0/examples/readme.rs000064400000000000000000000007670072674642500153220ustar 00000000000000// Update the code example in README.md whenever this example is changed. use bugreport::{bugreport, collector::*, format::Markdown}; fn main() { bugreport!() .info(SoftwareVersion::default()) .info(OperatingSystem::default()) .info(CommandLine::default()) .info(EnvironmentVariables::list(&["SHELL", "EDITOR"])) .info(CommandOutput::new("Python version", "python", &["-V"])) .info(CompileTimeInformation::default()) .print::(); } bugreport-0.5.0/examples/simple.rs000064400000000000000000000011110072674642500153360ustar 00000000000000use bugreport::{bugreport, collector::*, format::Markdown}; fn main() { bugreport!() .info(SoftwareVersion::default()) .info(OperatingSystem::default()) .info(CommandLine::default()) .info(EnvironmentVariables::list(&[ "SHELL", "PATH", "SIMPLE_VAR_1", "SIMPLE_VAR_2", ])) .info(CommandOutput::new("System information", "uname", &["-a"])) .info(FileContent::new("Load average", "/proc/loadavg")) .info(CompileTimeInformation::default()) .print::(); } bugreport-0.5.0/src/collector/directory_entries.rs000064400000000000000000000044650072674642500205600ustar 00000000000000use std::fs::{self, DirEntry}; use std::io::ErrorKind; use std::path::{Path, PathBuf}; use crate::{report::ReportEntry, Collector, CrateInfo, Result}; use super::CollectionError; /// List information about entries in a directory. /// /// Limitations: /// * Is not recursive /// * Does not handle symbolic links /// * Only sizes of files are printed and not e.g. time of last modification /// /// # Example /// /// ```md /// #### File and dir /// /// - file.txt, 14 bytes /// - some_dir/ /// /// ``` pub struct DirectoryEntries { title: String, path: PathBuf, } impl<'a> DirectoryEntries { pub fn new>(title: &'a str, path: P) -> Self { Self { title: title.into(), path: path.as_ref().to_path_buf(), } } } impl Collector for DirectoryEntries { fn description(&self) -> &str { &self.title } fn collect(&mut self, _: &CrateInfo) -> Result { let path_str = &self.path.to_string_lossy(); let mut entries = fs::read_dir(&self.path) .map_err(|e| read_dir_error_to_report_entry(e, path_str))? .map(|e| match e { Ok(dir_entry) => dir_entry_to_report_entry(dir_entry), Err(e) => format!("Error: {}", e), }) .collect::>(); // For stable ordering entries.sort(); if entries.is_empty() { Ok(ReportEntry::Text(format!("'{}' is empty", path_str))) } else { Ok(ReportEntry::List( entries.into_iter().map(ReportEntry::Text).collect(), )) } } } fn read_dir_error_to_report_entry(error: std::io::Error, path_str: &str) -> CollectionError { CollectionError::CouldNotRetrieve(if error.kind() == ErrorKind::NotFound { format!("'{}' not found", path_str) } else { format!("'{}' not read: {}", path_str, error) }) } fn dir_entry_to_report_entry(dir_entry: DirEntry) -> String { let mut text = String::new(); text.push_str(&dir_entry.file_name().to_string_lossy()); if let Ok(metadata) = dir_entry.metadata() { if metadata.is_file() { text.push_str(&format!(", {} bytes", metadata.len())); } else if metadata.is_dir() { text.push(std::path::MAIN_SEPARATOR); } } text } bugreport-0.5.0/src/collector.rs000064400000000000000000000236710072674642500150230ustar 00000000000000//! Contains all builtin information collectors and the [`Collector`] trait to implement your own. use std::borrow::Cow; use std::ffi::{OsStr, OsString}; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; use super::CrateInfo; use super::Result; use crate::helper::StringExt; use crate::report::{Code, ReportEntry}; mod directory_entries; pub use directory_entries::DirectoryEntries; /// Error that appeared while collecting bug report information. #[derive(Debug)] pub enum CollectionError { CouldNotRetrieve(String), } impl CollectionError { pub(crate) fn to_entry(&self) -> ReportEntry { use CollectionError::*; match self { CouldNotRetrieve(reason) => ReportEntry::Text(reason.clone()), } } } /// Implement this trait to define customized information collectors. pub trait Collector { fn description(&self) -> &str; fn collect(&mut self, crate_info: &CrateInfo) -> Result; } /// The name of your crate and the current version. #[derive(Default)] pub struct SoftwareVersion { version: Option, } impl SoftwareVersion { pub fn custom>(version: S) -> Self { Self { version: Some(version.as_ref().into()), } } } impl Collector for SoftwareVersion { fn description(&self) -> &str { "Software version" } fn collect(&mut self, crate_info: &CrateInfo) -> Result { let git_hash_suffix = match crate_info.git_hash { Some(git_hash) => format!(" ({})", git_hash), None => String::new(), }; Ok(ReportEntry::Text(format!( "{} {}{}", crate_info.pkg_name, self.version.as_deref().unwrap_or(crate_info.pkg_version), git_hash_suffix, ))) } } /// Compile-time information such as the profile (release/debug) and the target triple. #[derive(Default)] pub struct CompileTimeInformation {} impl Collector for CompileTimeInformation { fn description(&self) -> &str { "Compile time information" } fn collect(&mut self, _: &CrateInfo) -> Result { Ok(ReportEntry::List(vec![ ReportEntry::Text(format!("Profile: {}", env!("BUGREPORT_PROFILE"))), ReportEntry::Text(format!("Target triple: {}", env!("BUGREPORT_TARGET"))), ReportEntry::Text(format!( "Family: {}", env!("BUGREPORT_CARGO_CFG_TARGET_FAMILY") )), ReportEntry::Text(format!("OS: {}", env!("BUGREPORT_CARGO_CFG_TARGET_OS"))), ReportEntry::Text(format!( "Architecture: {}", env!("BUGREPORT_CARGO_CFG_TARGET_ARCH") )), ReportEntry::Text(format!( "Pointer width: {}", env!("BUGREPORT_CARGO_CFG_TARGET_POINTER_WIDTH") )), ReportEntry::Text(format!( "Endian: {}", env!("BUGREPORT_CARGO_CFG_TARGET_ENDIAN") )), ReportEntry::Text(format!( "CPU features: {}", env!("BUGREPORT_CARGO_CFG_TARGET_FEATURE") )), ReportEntry::Text(format!("Host: {}", env!("BUGREPORT_HOST"))), ])) } } /// The full command-line: executable name and arguments to the program. #[derive(Default)] pub struct CommandLine {} impl Collector for CommandLine { fn description(&self) -> &str { "Command-line" } fn collect(&mut self, _: &CrateInfo) -> Result { let mut result = String::new(); for arg in std::env::args_os() { result += &shell_escape::escape(arg.to_string_lossy()); result += " "; } Ok(ReportEntry::Code(Code { language: Some("bash".into()), code: result, })) } } /// The operating system (type and version). #[cfg(feature = "collector_operating_system")] #[derive(Default)] pub struct OperatingSystem {} #[cfg(feature = "collector_operating_system")] impl Collector for OperatingSystem { fn description(&self) -> &str { "Operating system" } fn collect(&mut self, _: &CrateInfo) -> Result { use std::ops::Deref; use sys_info::{os_release, os_type}; let os_type = os_type() .map_err(|_| CollectionError::CouldNotRetrieve("Operating system type".into()))?; let os_release = os_release(); let os_release = os_release .as_ref() .map(|t| t.deref()) .unwrap_or("(unknown version)"); #[cfg(target_os = "macos")] return Ok(ReportEntry::Text(format!( "{} ({} {})", macos_info_string(), os_type, os_release ))); #[cfg(not(target_os = "macos"))] Ok(ReportEntry::Text(format!("{} {}", os_type, os_release))) } } #[cfg(all(feature = "collector_operating_system", target_os = "macos"))] fn macos_info() -> Result<(String, String)> { fn sw_vers(arg: &str) -> Result { let stdout = Command::new("sw_vers") .arg(arg) .output() .map_err(|err| CollectionError::CouldNotRetrieve(err.to_string()))? .stdout; Ok(String::from_utf8_lossy(&stdout).trim().to_owned()) } let macos_name = sw_vers("-productName")?; let macos_version = sw_vers("-productVersion")?; Ok((macos_name, macos_version)) } #[cfg(all(feature = "collector_operating_system", target_os = "macos"))] fn macos_info_string() -> String { if let Ok((name, version)) = macos_info() { format!("{} {}", name, version) } else { "Unknown".to_owned() } } /// The values of the specified environment variables (if set). pub struct EnvironmentVariables { list: Vec, } impl EnvironmentVariables { pub fn list>(list: &[S]) -> Self { Self { list: list.iter().map(|s| s.as_ref().to_os_string()).collect(), } } } impl Collector for EnvironmentVariables { fn description(&self) -> &str { "Environment variables" } fn collect(&mut self, _: &CrateInfo) -> Result { let mut result = String::new(); for var in &self.list { let value = std::env::var_os(&var).map(|value| value.to_string_lossy().into_owned()); let value: Option = value.map(|v| shell_escape::escape(Cow::Borrowed(&v)).into()); result += &format!( "{}={}\n", var.to_string_lossy(), value.unwrap_or_else(|| "".into()) ); } result.pop(); Ok(ReportEntry::Code(Code { language: Some("bash".into()), code: result, })) } } /// The stdout and stderr output (+ exit code) of a custom command. pub struct CommandOutput<'a> { title: &'a str, cmd: OsString, cmd_args: Vec, } impl<'a> CommandOutput<'a> { pub fn new(title: &'a str, cmd: T, args: &[S]) -> Self where T: AsRef, S: AsRef, { let mut cmd_args: Vec = Vec::new(); for a in args { cmd_args.push(a.into()); } CommandOutput { title, cmd: cmd.as_ref().to_owned(), cmd_args, } } } impl<'a> Collector for CommandOutput<'a> { fn description(&self) -> &str { self.title } fn collect(&mut self, _: &CrateInfo) -> Result { let mut result = String::new(); result += "> "; result += &self.cmd.to_string_lossy(); result += " "; for arg in &self.cmd_args { result += &shell_escape::escape(arg.to_string_lossy()); result += " "; } result += "\n"; let output = Command::new(&self.cmd) .args(&self.cmd_args) .output() .map_err(|e| { CollectionError::CouldNotRetrieve(format!( "Could not run command '{}': {}", self.cmd.to_string_lossy(), e )) })?; let utf8_decoding_error = |_| { CollectionError::CouldNotRetrieve(format!( "Error while running command '{}': output is not valid UTF-8.", self.cmd.to_string_lossy() )) }; let stdout = String::from_utf8(output.stdout).map_err(utf8_decoding_error)?; let stderr = String::from_utf8(output.stderr).map_err(utf8_decoding_error)?; result += &stdout; result += &stderr; result.trim_end_inplace(); let mut concat = vec![ReportEntry::Code(Code { language: None, code: result, })]; if !output.status.success() { concat.push(ReportEntry::Text(format!( "Command failed{}.", output .status .code() .map_or("".into(), |c| format!(" with exit code {}", c)) ))); } Ok(ReportEntry::Concat(concat)) } } /// The full content of a text file. pub struct FileContent<'a> { title: &'a str, path: PathBuf, } impl<'a> FileContent<'a> { pub fn new>(title: &'a str, path: P) -> Self { Self { title, path: path.as_ref().to_path_buf(), } } } impl<'a> Collector for FileContent<'a> { fn description(&self) -> &str { self.title } fn collect(&mut self, _: &CrateInfo) -> Result { let mut result = fs::read_to_string(&self.path).map_err(|e| { CollectionError::CouldNotRetrieve(format!( "Could not read contents of '{}': {}.", self.path.to_string_lossy(), e )) })?; result.trim_end_inplace(); Ok(ReportEntry::Code(Code { language: None, code: result, })) } } bugreport-0.5.0/src/format/markdown.rs000064400000000000000000000020560072674642500161410ustar 00000000000000use super::Format; use crate::report::ReportEntry; #[derive(Default)] pub struct Markdown {} impl Format for Markdown { fn format_section(&mut self, title: &str) -> String { format!("#### {}\n\n", title) } fn format_entry(&mut self, entry: &ReportEntry) -> String { use ReportEntry::*; match entry { Text(content) => format!("{}\n", content), Code(c) => format!( "```{}\n{}\n```\n", c.language.as_deref().unwrap_or(""), c.code ), List(entries) => { let mut result = String::new(); for entry in entries { result += "- "; result += &self.format_entry(entry); } result } Concat(entries) => { let mut result = String::new(); for entry in entries { result += &self.format_entry(entry); } result } } } } bugreport-0.5.0/src/format/mod.rs000064400000000000000000000007220072674642500150740ustar 00000000000000//! Different formats for printing the report. use crate::report::ReportEntry; #[cfg(feature = "format_markdown")] mod markdown; #[cfg(feature = "format_plaintext")] mod plaintext; #[cfg(feature = "format_markdown")] pub use markdown::Markdown; #[cfg(feature = "format_plaintext")] pub use plaintext::Plaintext; pub trait Format: Default { fn format_section(&mut self, title: &str) -> String; fn format_entry(&mut self, entry: &ReportEntry) -> String; } bugreport-0.5.0/src/format/plaintext.rs000064400000000000000000000017030072674642500163250ustar 00000000000000use super::Format; use crate::report::ReportEntry; #[derive(Default)] pub struct Plaintext {} impl Format for Plaintext { fn format_section(&mut self, title: &str) -> String { format!("{:-^1$}\n", title, 48) } fn format_entry(&mut self, entry: &ReportEntry) -> String { use ReportEntry::*; match entry { Text(content) => format!("{}\n", content), Code(c) => format!("{}\n", c.code), List(entries) => { let mut result = String::new(); for entry in entries { result += "- "; result += &self.format_entry(entry); } result } Concat(entries) => { let mut result = String::new(); for entry in entries { result += &self.format_entry(entry); } result } } } } bugreport-0.5.0/src/helper.rs000064400000000000000000000005220072674642500143020ustar 00000000000000pub(crate) trait StringExt { fn trim_end_inplace(&mut self); } impl StringExt for String { fn trim_end_inplace(&mut self) { self.truncate(self.trim_end().len()); } } #[test] fn test_trim_end_inplace() { let mut s = String::from("test string \n\n"); s.trim_end_inplace(); assert_eq!(s, "test string"); } bugreport-0.5.0/src/lib.rs000064400000000000000000000102000072674642500135630ustar 00000000000000//! `bugreport` is a library that helps application developers to automatically collect //! information about the system and the environment that users can send along with a bug //! report (similar to `git bugreport` or `ffmpeg … -report`). //! //! Usage example: //! ``` //! use bugreport::{bugreport, collector::*, format::Markdown}; //! //! bugreport!() //! .info(SoftwareVersion::default()) //! .info(OperatingSystem::default()) //! .info(CommandLine::default()) //! .info(EnvironmentVariables::list(&["SHELL", "EDITOR"])) //! .info(CommandOutput::new("Python version", "python", &["--version"])) //! .info(CompileTimeInformation::default()) //! .print::(); //! ``` use std::result; pub mod collector; pub mod format; mod helper; pub mod report; use collector::{CollectionError, Collector}; use format::Format; use report::{Report, ReportSection}; pub(crate) type Result = result::Result; #[doc(hidden)] pub struct CrateInfo<'a> { pkg_name: &'a str, pkg_version: &'a str, git_hash: Option<&'a str>, } /// The main struct for collecting bug report information. /// /// Use the [`bugreport`] macro to create one. pub struct BugReport<'a> { info: CrateInfo<'a>, collectors: Vec>, } impl<'a> BugReport<'a> { #[doc(hidden)] pub fn from_name_and_version(pkg_name: &'a str, pkg_version: &'a str) -> Self { BugReport { info: CrateInfo { pkg_name, pkg_version, git_hash: None, }, collectors: vec![], } } #[doc(hidden)] pub fn set_git_hash(&mut self, git_hash: Option<&'a str>) { self.info.git_hash = git_hash; } /// Add a [`Collector`] to the bug report. pub fn info(mut self, collector: C) -> Self { self.collectors.push(Box::new(collector)); self } fn generate(&mut self) -> Report { let mut sections = vec![]; for collector in &mut self.collectors { let entry = collector .collect(&self.info) .unwrap_or_else(|e| e.to_entry()); sections.push(ReportSection { title: collector.description(), entry, }); } Report { sections } } /// Assemble the bug report information using the given format. pub fn format(&mut self) -> String { let mut format = F::default(); self.generate().format_as(&mut format) } /// Print the bug report information using the given format. pub fn print(&mut self) { println!("{}", self.format::()); } } /// Re-export so dependent project does not have to manually depend on git-version crate #[cfg(feature = "git_hash")] pub use git_version::git_version; #[cfg(feature = "git_hash")] #[doc(hidden)] #[macro_export] macro_rules! bugreport_set_git_hash { ($br:ident) => {{ let hash = bugreport::git_version!(fallback = ""); if !hash.is_empty() { $br.set_git_hash(Some(hash)); } }}; } #[cfg(not(feature = "git_hash"))] #[doc(hidden)] #[macro_export] macro_rules! bugreport_set_git_hash { ($br:ident) => {}; } /// Generate a new [`BugReport`] object. #[macro_export] macro_rules! bugreport { () => {{ let mut br = bugreport::BugReport::from_name_and_version( env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), ); bugreport::bugreport_set_git_hash!(br); br }}; } #[cfg(test)] mod tests { #[test] #[cfg(feature = "format_markdown")] fn basic() { use super::BugReport; use crate::collector::*; use crate::format::Markdown; std::env::set_var("BUGREPORT_TEST", "42"); let report = BugReport::from_name_and_version("dummy", "0.1") .info(EnvironmentVariables::list(&["BUGREPORT_TEST"])) .format::(); assert_eq!( report, "#### Environment variables\n\ \n\ ```bash\n\ BUGREPORT_TEST=42\n\ ```\n\n" ); } } bugreport-0.5.0/src/report.rs000064400000000000000000000016530072674642500143440ustar 00000000000000//! Defines the document structure of the report. Only needed for custom collectors. use crate::format::Format; #[derive(Debug)] pub struct Code { pub language: Option, pub code: String, } #[derive(Debug)] pub enum ReportEntry { Text(String), Code(Code), List(Vec), Concat(Vec), } #[derive(Debug)] pub(crate) struct ReportSection<'a> { pub(crate) title: &'a str, pub(crate) entry: ReportEntry, } impl ReportEntry {} #[derive(Debug)] pub(crate) struct Report<'a> { pub(crate) sections: Vec>, } impl<'a> Report<'a> { pub fn format_as(&self, format: &mut impl Format) -> String { let mut result = String::new(); for section in &self.sections { result += &format.format_section(section.title); result += &format.format_entry(§ion.entry); result += "\n"; } result } } bugreport-0.5.0/test-crates/README.md000064400000000000000000000011050072674642500154010ustar 00000000000000This directory contains crates used to test `bugreport`. It is insufficient to test bugreport with regular crate test facilities, due to how bugreport is implemented. Since bugreport uses a `bugreport!()` macro that is evaluated in the context of a dependent crate, it is important to test evaluation of that macro in an external create. Otherwise the test will not detect problems such as having `#[cfg(feature = "git_hash")]` inside the `bugreport!()` macro. Since the macro is evaluated in the context of the dependent crate, that feature will not be defined in that context. bugreport-0.5.0/test-crates/run-all-tests.sh000075500000000000000000000010340072674642500171740ustar 00000000000000#!/usr/bin/env bash set -o errexit -o nounset -o pipefail script_path="$(pwd)/$(dirname ${BASH_SOURCE})" test_crates=" bugreport-client-with-git-hash-feature bugreport-client-without-git-hash-feature " for test_crate in ${test_crates}; do cd ${script_path}/${test_crate} # Test with a git repo (our own) unset GIT_DIR cargo clean -p ${test_crate} cargo test with_git_repo # Test without a git repo export GIT_DIR=this-is-not-a-git-repo cargo clean -p ${test_crate} cargo test without_git_repo done bugreport-0.5.0/tests/test_collector_directory_entries.rs000064400000000000000000000042120072674642500222400ustar 00000000000000#![cfg(feature = "format_markdown")] use std::path::PathBuf; use pretty_assertions::assert_eq; use tempfile::tempdir; use bugreport::{bugreport, collector::DirectoryEntries, format::Markdown}; #[test] fn dir_not_found() { let actual = bugreport!() .info(DirectoryEntries::new("No dir", "this-dir-does-not-exist")) .format::(); let expected = "#### No dir 'this-dir-does-not-exist' not found "; assert_eq!(expected, actual); } #[test] fn dir_is_empty() -> Result<(), std::io::Error> { let empty_dir = tempdir()?; let empty_dir_path = empty_dir.path(); let actual = bugreport!() .info(DirectoryEntries::new("Empty dir", empty_dir_path)) .format::(); let expected = format!( "#### Empty dir '{}' is empty ", empty_dir_path.to_string_lossy() ); assert_eq!(expected, actual); Ok(()) } #[test] fn dir_exists() -> Result<(), std::io::Error> { let dir = tempdir()?; let dir_path = dir.path(); // Put a file in the dir let mut some_file = PathBuf::from(dir_path); some_file.push("file.txt"); std::fs::write(some_file, "This is a file")?; // Put a dir in the dir let mut some_dir = PathBuf::from(dir_path); some_dir.push("some_dir"); std::fs::create_dir(some_dir)?; let actual = bugreport!() .info(DirectoryEntries::new("File and dir", dir_path)) .format::(); #[allow(unused_mut)] let mut expected = String::from( "#### File and dir - file.txt, 14 bytes - some_dir/ ", ); #[cfg(windows)] { expected = expected.replace("some_dir/", "some_dir\\"); } assert_eq!(expected, actual); Ok(()) } #[test] fn new() { DirectoryEntries::new("a", "/a"); // Not possible yet: DirectoryEntries::new(String::from("b"), PathBuf::from("/b")); DirectoryEntries::new(&String::from("c"), &PathBuf::from("/c")); new_with_title_from_local_variable(); } fn new_with_title_from_local_variable() -> DirectoryEntries { let local_variable = String::from("pretend this is dynamically constructed"); DirectoryEntries::new(&local_variable, "/path") }