GithubHelp home page GithubHelp logo

chrisvest / xxv Goto Github PK

View Code? Open in Web Editor NEW
85.0 4.0 5.0 908 KB

The XXV visual hex viewer for the terminal.

Home Page: https://chrisvest.github.io/xxv/

Rust 99.90% Shell 0.10%
hex rust tui cli rust-lang xxd binary-data hexadecimal bytes developer-tools

xxv's Introduction

The XXV Hex Viewer

Build status Source code Gitter chat License

XXV is a terminal hex viewer with a text user interface, written in 100% safe Rust. Licensed under the GPL-3.0 software license.

Get it from crates.io by running cargo install xxv in your terminal. Make sure you have a proper development environment first, though. Windows is supported with the Crossterm backend: cargo install xxv --no-default-features --features crossterm.

Screenshot showing the XXV hex viewer in a terminal

xxv's People

Contributors

chrisvest avatar gyscos avatar lespea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xxv's Issues

Travis CI.

  • Set PR building with Travis.
  • Add build status sticker to the Readme.adoc and Cargo.toml.

build error on windows

On windows 10, I run cargo install xv, but I get such error: error: failed to run custom build command for ncurses v5.99.0

failed to cargo install

error[E0432]: unresolved import `syn::export`
  --> /home/laoshaw/.cargo/registry/src/github.com-1ecc6299db9ec823/enumset_derive-0.4.4/src/lib.rs:10:10
   |
10 | use syn::export::Span;
   |          ^^^^^^ could not find `export` in `syn`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `enumset_derive` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `xxv v0.1.2`, intermediate artifacts can be found at `/tmp/cargo-installohZX3q`

Caused by:
  build failed
     Failed to install xxv (see error(s) above).

Viewing data piped from stdin

We need fseek(3) for navigating, so we'll probably have to pipe the data into a temporary file and open a hex view on that.

Can we move data lazily as we read towards the end? Asynchronous IO would be helpful here, to avoid the involvement of threads.

Cargo install issues

Using:
stable-x86_64-unknown-linux-gnu (default)
rustc 1.34.1 (fc50f328b 2019-04-24)
cargo 1.34.0 (6789d8a0a 2019-04-01)

Tried cargo install xv received.

Compiling ncurses v5.99.0 (/home/srufle/code/github.com/ncurses-rs)
error: failed to run custom build command for `ncurses v5.99.0 (/home/srufle/code/github.com/ncurses-rs)`
process didn't exit successfully: `/home/srufle/code/github.com/ncurses-rs/target/debug/build/ncurses-205a0782d1415f39/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rustc-link-lib=ncurses
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

--- stderr
/home/srufle/code/github.com/ncurses-rs/target/debug/build/ncurses-09c413476e50b4b0/out/chtype_size.c:6:10: fatal error: ncurses.h: No such file or directory
 #include <ncurses.h>
          ^~~~~~~~~~~
compilation terminated.
thread 'main' panicked at 'assertion failed: command.status().expect("compilation failed").success()', build.rs:105:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Fixed by sudo apt-get install ncurses-dev

Tried cargo install xv again received

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/srufle/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installw62YIl/release/deps/xv-dc4a671fee87ad48.xv.57xxopd5-cgu.0.rcgu.o" "-o" "/tmp/cargo-installw62YIl/release/deps/xv-dc4a671fee87ad48" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/tmp/cargo-installw62YIl/release/deps" "-L" "/tmp/cargo-installw62YIl/release/build/backtrace-sys-b9dc6c3db1afc696/out" "-L" "/home/srufle/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustc20eSFZ/libbacktrace_sys-44efdd5e993998ee.rlib" "-Wl,--start-group" "/tmp/rustc20eSFZ/libbacktrace_sys-8dcce133820ce36b.rlib" "-Wl,--end-group" "/home/srufle/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-ccce53ba085ea72e.rlib" "-Wl,-Bdynamic" "-lncursesw" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: cannot find -lncursesw
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: failed to compile `xv v0.1.0`, intermediate artifacts can be found at `/tmp/cargo-installw62YIl`

Caused by:
  Could not compile `xv`.

To learn more, run the command again with --verbose.

Replace rmp-serde with toml

Since Cursive pulls in the toml crate anyway, we might as well also make use of it for persisting XvState.

That way we can remove a dependency, and make the binary smaller.

Build error installing from crates.io

Trying to install via cargo gives the error

error[E0432]: unresolved import `syn::export`
  --> /scratch/usr/cargo/registry/src/github.com-1ecc6299db9ec823/enumset_derive-0.4.4/src/lib.rs:10:10
   |
10 | use syn::export::Span;
   |          ^^^^^^ could not find `export` in `syn`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `enumset_derive`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `xxv v0.1.2`, intermediate artifacts can be found at `/tmp/cargo-installIR0PwI`

Caused by:
  build failed

It looks like this was changed in a patch version of syn here. As xxv doesn't depend on syn directly, this might be an issue for one of the other crates but there might be workarounds that can be done from here.

Re-licencing to GPL-3

@gyscos Are you okay with your changes in #16 being re-licensed to GPL-3? There's a crate I'm interested in depending on, but Apache 2.0 programs are not allowed to link GPL licensed libraries.

Readme and Website updates for 0.1.

  • Add link to the github sources repository to the website.
  • Add cargo install xv instructions to readme and website, once it's up on crates.io.

Binary diff mode.

It's not entirely clear what this means, precisely.

Something already exists for this use case, which may provide inspiration: https://github.com/madsen/vbindiff

Best bet is probably the Myers diff algorithm, or a variant thereof:

The Myers diff can be implemented in linear space, which is quite compelling. There will likely be some up-front computing cost to produce the edit sequence, but once built and indexed, I imagine it'd be possible to inject the necessary edit sequence elements into the rendering of arbitrarily positioned and sized view ports.

And important challenge is that the algorithm might be faced with gigabyte deltas in terabyte files, and it must still finish in "reasonable" time.

Keyboard shortcuts for navigating to next and previous difference would also be helpful.

Finding alignments like in BLAST might also be useful:

Disallow scrolling beyond end of file.

Both keyboard navigation and the "Go to" dialog allow navigating to locations far beyond the end of the file. This needs to be prevented.

  • Disallow navigating beyond bottom edge with keyboard movements.
  • Jumping to line or offset beyond bottom edge with the "Go to" dialog, must land the viewport at the bottom edge.
  • Changing the line width must also move the viewport to the same file offset it was placed at before the line width change.

Panic when reading from fifo or named pipe

If I pass xxv a fifo or a named pipe (such as /dev/stdin) it promptly panics, leaving my terminal in a bad state.



Panic in xxv 0.1.2, 2020-05-20T11:03:25-07:00.
System: macos (unix), x86_64.
Location: src/hex_view.rs:397:13.

   0:        0x10628140d - backtrace::capture::Backtrace::new::ha9f89a6fa35894cc
   1:        0x10626fffb - xxv::panic_hook::install::{{closure}}::h8cc3772e827e167c
   2:        0x1062aeca4 - std::panicking::rust_panic_with_hook::he4f5d8b43533efd5
   3:        0x1062aea69 - rust_begin_unwind
   4:        0x106285e4f - core::panicking::panic_fmt::h3559129da805eab4
   5:        0x106286025 - core::result::unwrap_failed::h170de03e7ee26a1a
   6:        0x10625a28d - cursive::view::view_wrapper::<impl cursive::view::view_trait::View for T>::layout::hd14996d839b09c6c

Name mismatch in persisted state

Was this app previously called xv? It caught me by surprise that I had an xv/xv.state file in my .config directory but had nothing called xv on my machine.

Would it be considered a breaking change to use xxv/xxv,.state for that file instead? It would potentially be better suited to somewhere like ~/.local/state, ~/.cache or ~/.local/share instead of .config as well (or equivalent for other OSes).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.