Skip to content

Conversation

@hyperupcall
Copy link
Contributor

@hyperupcall hyperupcall commented Aug 26, 2023

Before submitting a pull request, please make sure the following is done:

  • Fork the repository and create your branch from master.
  • If you've added code that should be tested, add tests!
  • Ensure the test suite passes.
  • Lint your code with ShellCheck.
  • Include a human-readable description of what the pull request is trying to accomplish.
  • Steps for the reviewer(s) on how they can manually QA the changes.
  • Have a fixes #XX reference to the issue that this pull request fixes.

Code inspired by this comment, this PR fixes the sed command on BSD/Busybox, etc. platforms in which GNU sed is not used.

Unlike what some comments in the linked issue suggests, the approach of exporting the function so todotxt add-ons can automatically use the fix was not done. This is because that would be a breaking change and there is no way we can guarantee that the assumptions of this sed() function hold true for all plugin code.

How to test:

make test

Closes #168

@hyperupcall hyperupcall changed the title fix: Improve fallback when using sed fix: Improve GNU sed fallback Aug 26, 2023
@inkarkat
Copy link
Member

On Ubuntu (and I think Cygwin as well), there's no gsed command, only (GNU) sed. The sed() wrapper would use the in-place emulation there, which I think would be a bad side effect. Auto-detecting GNU sed is difficult and has a performance impact as well - I don't want to go down that route. In #447 (created because you don't allow pushes to your fork), I've tried to address this via new config variables. What do you think about that?

@hyperupcall
Copy link
Contributor Author

What do you think about that?

I think it's better compared to the original code, but like you mention, it still uses the sed() wrapper by default (TODOTXT_SED_COMMAND is unset by default), which is probably suboptimal. But I have an idea to address that!- I'll comment on the new PR

created because you don't allow pushes to your fork

I would if I could, but unfortunately, GitHub does not allow pushes to my fork because the repository is owned by an organization instead of a user 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline mode not supported by NetBSD's sed

2 participants