Loading ...
Sorry, an error occurred while loading the content.

BUG: xxd -r strips a byte depending on value of last byte of binary

Expand Messages
  • Britton Kerin
    This buffer content: 0000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000010: 0a When subjected to :%!xxd -r -g 1 yields a 16 byte
    Message 1 of 3 , Apr 26, 2012
    • 0 Attachment
      This buffer content:

      0000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      0000010: 0a

      When subjected to ':%!xxd -r -g 1' yields a 16 byte buffer and if saved
      a sixteen byte file. Note that the input is 17 bytes long.

      This buffer content on the other hand:

      0000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a ................
      0000010: 00

      When subjected to the same command yields the expected 17 byte buffer
      and file if saved.

      Note that the only difference is the position of the last two bytes is swapped.

      This buffer content:

      0000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a ................
      0000010: fa

      also yields a buffer and file of the correct length.

      Using a plain format ascii representation file with the -p option to xxd
      gives the same odd results.

      It appears that xxd -r has some preternatural hatred for trailing 0a bytes
      (and maybe others).

      Britton

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • John Little
      Sorry, I can t reproduce this, vim 7.3.475 and xxd V1.10 on linux. What versions and OS? What 16 bytes do you get? I suspected there was some interaction with
      Message 2 of 3 , Apr 26, 2012
      • 0 Attachment
        Sorry, I can't reproduce this, vim 7.3.475 and xxd V1.10 on linux.
        What versions and OS? What 16 bytes do you get?

        I suspected there was some interaction with the endofline option, which applies if you set binary, but I have to explicitly :set binary noeol before saving to get a 16 byte file on saving, and I see [noeol] in vim's saving message.

        Regards, John


        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Britton Kerin
        Hmm, I can t either. How annoying. I saw it many many times the other day, not sure what was different. My vi setup sometimes inserts a gratuitous ^]
        Message 3 of 3 , May 1 3:30 PM
        • 0 Attachment
          Hmm, I can't either. How annoying. I saw it many many times the
          other day, not sure what was different. My vi setup sometimes inserts
          a gratuitous ^] character when I'm coding, I don't know when in my
          many .vimrc changes it started doing it, but it looks like a
          non-printing character representation or something, maybe it was
          related to that. But that's only a long-shot guess.

          Britton

          On Thu, Apr 26, 2012 at 9:47 PM, John Little <John.B.Little@...> wrote:
          > Sorry, I can't reproduce this, vim 7.3.475 and xxd V1.10 on linux.
          > What versions and OS?  What 16 bytes do you get?
          >
          > I suspected there was some interaction with the endofline option, which applies if you set binary, but I have to explicitly :set binary noeol before saving to get a 16 byte file on saving, and I see [noeol] in vim's saving message.
          >
          > Regards, John
          >
          >
          > --
          > You received this message from the "vim_dev" maillist.
          > Do not top-post! Type your reply below the text you are replying to.
          > For more information, visit http://www.vim.org/maillist.php

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.