Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SED doing wrong in binary hex file. #928

Open
jonas18z opened this issue Jan 10, 2019 · 2 comments
Open

SED doing wrong in binary hex file. #928

jonas18z opened this issue Jan 10, 2019 · 2 comments
Labels
fix

Comments

@jonas18z
Copy link

@jonas18z jonas18z commented Jan 10, 2019

Node version (or tell us if you're using electron or some other framework):

v11.6.0

ShellJS version (the most recent version/Github branch you see the bug on):

shelljs@0.8.3

Operating system:

MacOS 10.14.2

Description of the bug:

Failing att using SED and hex

Example ShellJS command to reproduce the error:

var shell = require('shelljs');
find = Buffer.from('FF0090', 'hex');
replace = Buffer.from('BBCC10', 'hex');
console.log (find.toString('ascii'));
console.log (replace.toString('ascii'));
shell.sed('-i', find , replace.toString('ascii'), 'test.bin');

test.bin before operation in hex
FF0090

test.bin after operation in hex
3B4C10

The testbin should contain in hex
BBCC10

Also tryed
shell.sed('-i', find , replace, 'test.bin');
But that gives me error:
"sed: invalid replacement string"

@nfischer
Copy link
Member

@nfischer nfischer commented Jan 13, 2019

Does unix sed support this sort of thing? Can you write the shell analog?

@nfischer
Copy link
Member

@nfischer nfischer commented Jan 13, 2019

You might also find parts of the discussion on #645 to be interesting, although it seems this is an issue with input type validation, not with data corruption (so, clearly not a duplicate issue).

@nfischer nfischer added the fix label Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.