Hi
On Jan 15, 2011, at 6:17 PM, Glyn Kennington <[email protected]> wrote:
> Hi,
> I've been using radare to edit multibyte characters in text files,
> and I've found that the support for the resize command's "strip N bytes"
> option ("r -#", as mentioned in the section 3.8 of the docs) varies
> between versions:
The documentation you are reading is based on the first version of radare.
ired just aims to follow few basic ops without being restricted to the
documentation of r1.
In the other side, the current development happens in r2. But this doesnt mean
that it is full featured or complete.
In this case. You just hit one of the missing commands in r2 :) it's in the
TODO. do you mind to implement it and send a patch?
> ired works as intended (syntax "r-#")
>
> In radare2, "r" isn't supported at all. Commented-out code suggests
> that it may be handled by a plugin, though I can't see anything relevant
> in radare2-extras.
Uhm, which comment? I think 'r' must be in core.
> radare interprets -N wrongly: get_math() returns unsigned values, and
> -N becomes (offset - N), so if offset > N, the size is made negative by
> the following line in radare_resize()
> ------
> size = -size; // be positive
> ------
> resulting in the file being extended.
>
Tell me file:line or send patch in diff format.
> Changing that line to
> ------
> size = get_math(arg+1);
> ------
> fixes it for me.
>
It would be great to have some test suite to ensure those commands keep
compatibility between versions and dont break.
It's also in TODO.. But this requires some more human power because writing
test cases is not as fun as coding new features or hunt bugs.
> Another feature that I think might be useful here is a matching
> r +#
> syntax to insert bytes, shifting the rest of the file up.
Isnt this already implemented in r1 or ired? In r1 theres also thr eval var
write.insert that shifts bytes when using the 'w' command. I agree that r+ must
be implemented too.
> I suppose this isn't a commonly-used function on files containing
> executable code, but it's something I occasionally need when editing
> data streams. Is there another obvious way of doing this that I've
> missed? And if not, is it worth me hacking about further and submitting
> some patches, for either version?
Feel free to submit the patches. I'll ve happy to review them and commit. :)
The 'r' command should be implemented in r1, r2 and ired.
Im actually busy fixing stuff in the build system of r2 ( in fact im writing a
new one ) and doing some refactoring in r-io api... I plan to work on the ranal
api later, so your patches will not conflict in any of the files affected by my
work.
--pancake
>
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org