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

Please support the BSD sed #10

Closed
yurivict opened this issue Apr 21, 2020 · 8 comments
Closed

Please support the BSD sed #10

yurivict opened this issue Apr 21, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@yurivict
Copy link

No description provided.

@yurivict
Copy link
Author

Ideally, on BSD it should be able to debug both BSD sed and GNU gsed, maybe based on the command argument.

@SoptikHa2
Copy link
Owner

Does this work with BSD sed, not the gnu version? I thought it will not work at all, and didn't test it, but now when I'm looking to manpages, there doesn't seem to be a reason this shouldn't work.

I can certainly provide a way to call different program instead of sed, maybe something like --binary-name=gsed?

@SoptikHa2 SoptikHa2 added the enhancement New feature or request label Apr 21, 2020
@yurivict
Copy link
Author

At least a sed command invocation causes a failure, see #9

@SoptikHa2
Copy link
Owner

SoptikHa2 commented Apr 21, 2020

It looks like sed doesn't like being invoked the way desed does. Does this work?

sed --debug -f x.sed input.txt
sed -E --debug -f x.sed input.txt

It works for me when I run sed in posix mode.

Anyway, if you build from source, I added some debug printing (use --debug) that clearly describes how is sed executed (some actually useful debug info coming soon) and option to specify what to execute with --sed-path=gsed. I'll add those to a release when I fix at least #9.

@yurivict
Copy link
Author

Does this work?

No:

[yuri@yv /tmp]$ sed --debug -f x.sed input.txt
sed: illegal option -- -
usage: sed script [-Ealnru] [-i extension] [file ...]
	sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]
[yuri@yv /tmp]$ sed -E --debug -f x.sed input.txt
sed: illegal option -- -
usage: sed script [-Ealnru] [-i extension] [file ...]
	sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]

@SoptikHa2
Copy link
Owner

Thank you for testing. Unfortunately there is no way desed is going to work with BSD sed - I need the extra information that I get from usage of the —debug flag.

If that’s all I’ll close this when I release new version with the —sed-path option. I’ll look into way to detect early that something went wrong and try to use gsed automatically.

@yurivict
Copy link
Author

gsed and sed are different programs on BSDs.

sed apparently has different invocation arguments. It would be best if desed would support both programs.

@SoptikHa2
Copy link
Owner

Unfortunately I need debug output from sed. With gnu sed it's achieved with the --debug flag, which prints detailed annotation of what sed does. If BSD sed doesn't have it, I can't do anything. If there is something like that, maybe under different flag, let me know and I'll add it.

For now, I've added automatic fallback to gsed if sed fails, so if you have both programs installed, it should work out of the box and you won't even notice it. One can override this behaviour with --sed-path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants