Giter Site home page Giter Site logo

Comments (4)

AlexZoe avatar AlexZoe commented on June 23, 2024 2

Hey, Raafat, I ran into the same issue and investigate a bit to see what's wrong.

It seems the conversion with HexDump inserts random bytes into the dump file, which obviously breaks the binary file when writing the buffer back to disk with HexAssemble.
This happens for both manual conversion and automatic one (i.e. ReadBuf and WriteBuf).

Using the same xxd commands manually in a terminal works without problems.
Converting a binary file to a hexdump in nvim also works directly in ExecMode (%! xxd -g 1 -u <file>).

NVim version used with LinuxMint 20.1.

NVIM v0.10.0-dev-289+gfa1baa9a4
Build type: Release
LuaJIT 2.1.0-beta3

I attached two screenshots below to show the output side by side (left: regular dump, right: HexDump).
The first image shows the differing sizes (hex offset at the bottom).
The second highlights the first line where random bytes got inserted.

I hope this helps.

differing_size
random_chars

from hex.nvim.

RaafatTurki avatar RaafatTurki commented on June 23, 2024

Writing the buffer triggers a binary "rebuild" from the hex dump using xxd.

  • Are you sure your xxd is properly working? (try using it to dump and revert a binary file)?
  • Does this occur with other file types such as a png file?

from hex.nvim.

daephx avatar daephx commented on June 23, 2024

I did some tests to find if there was any discrepancies.
The issue persists on WSL and on bare metal pop_OS, both with minimal config.
However, so far I can only reproduce the issue when my CWD is ~/.config/nvim.
If I do the same exact steps somewhere else like a /tmp folder, the issue doesn't occur.

When writing the dump buffer the "Hello, World!" string get shifted ~20 lines downward, resulting in the exec format error.

from hex.nvim.

daephx avatar daephx commented on June 23, 2024

Are you sure your xxd is properly working? (try using it to dump and revert a binary file)?

I can't be sure, I'm not too familiar with the program.

Does this occur with other file types such as a png file?

I did test a image file located at ~/Downloads/image.jpg without issue.
I'm not sure if you or someone else could reproduce but it seems like some obscure behaviour that the rebuilding would not work in neovim config directory.

cd ~/.config/nvim
nvim -u minimal_config.lua
# Write hello.c
$ gcc hello.c
$ ./a.out
Hello, World!

# Modify "Hello, World!" and write hex
$ ./a.out
exec format error: ./a.out

from hex.nvim.

Related Issues (16)

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.