Skip to content

Implement stateful SimpleStringBuffer#992

Closed
wtdcode wants to merge 1 commit into
devfrom
fix_pipe
Closed

Implement stateful SimpleStringBuffer#992
wtdcode wants to merge 1 commit into
devfrom
fix_pipe

Conversation

@wtdcode
Copy link
Copy Markdown
Member

@wtdcode wtdcode commented Nov 10, 2021

Checklist

Which kind of PR do you create?

  • This PR only contains minor fixes.
  • This PR contains major feature update.
  • This PR introduces a new function/api for Qiling Framework.

Coding convention?

  • The new code conforms to Qiling Framework naming convention.
  • The imports are arranged properly.
  • Essential comments are added.
  • The reference of the new code is pointed out.

Extra tests?

  • No extra tests are needed for this PR.
  • I have added enough tests for this PR.
  • Tests will be added after some discussion and review.

Changelog?

  • This PR doesn't need to update Changelog.
  • Changelog will be updated after some proper review.
  • Changelog has been updated in my PR.

Target branch?

  • The target branch is dev branch.

One last thing


@elicn
Copy link
Copy Markdown
Member

elicn commented Nov 10, 2021

@wtdcode, can you give a little bit of context around that fix..?

As stated on the SimpleStringBuffer docstring, it is a FIFO stream; being able to seek is a random access feature which breaks the FIFO property. That also requires storing the entire content of the stream throughout its lifetime (i.e. reading part of it doesn't let you get rid of that part), which becomes problematic when using it for stdout that may potentially yield tons of output.

Would you prefer to create a RandomStream class that supports seek, just like io.BufferedRandom ?

@wtdcode
Copy link
Copy Markdown
Member Author

wtdcode commented Nov 10, 2021

@wtdcode, can you give a little bit of context around that fix..?

As stated on the SimpleStringBuffer docstring, it is a FIFO stream; being able to seek is a random access feature which breaks the FIFO property. That also requires storing the entire content of the stream throughout its lifetime (i.e. reading part of it doesn't let you get rid of that part), which becomes problematic when using it for stdout that may potentially yield tons of output.

Would you prefer to create a BufferedStream class that supports seek, just like io.BufferedRandom ?

Yes, you are right. I would create another subclass.

@elicn
Copy link
Copy Markdown
Member

elicn commented Nov 10, 2021

Yes, you are right. I would create another subclass.

Consider adding:

def seekable(self) -> bool:
    return True

To indicate it is a seek-able stream.

@elicn
Copy link
Copy Markdown
Member

elicn commented Nov 25, 2021

Not sure, but I think @wtdcode wanted to create another PR instead of this one.

@wtdcode
Copy link
Copy Markdown
Member Author

wtdcode commented Nov 25, 2021 via email

@wtdcode
Copy link
Copy Markdown
Member Author

wtdcode commented Jan 19, 2022

Closed due to #1071

@wtdcode wtdcode closed this Jan 19, 2022
@elicn elicn deleted the fix_pipe branch July 20, 2022 14:22
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.

3 participants