trifectatechfoundation / sudo-rs

A memory safe implementation of sudo and su.
Other
2.9k stars 79 forks source link

Poll the terminals according to the buffer state #611

Closed pvdrz closed 1 year ago

pvdrz commented 1 year ago

Describe the changes done on this pull request This PR changes the exec::pipe module so each side of the pipe is only polled if the buffer can handle the event:

This also takes care of resuming the events when the buffer changes state.

Some changes were also made to the development logs so they are more useful:

This PR is better reviewed on a commit-per-commit basis.

Pull Request Checklist

github-actions[bot] commented 1 year ago

Number of dependencies and binary size impact report

Metric main PR #611 Delta
Direct dependencies 5 5 -
Total dependencies 10 10 -
Binary size 985.4 KiB 994 KiB +0.9%
Text size 569.7 KiB 575 KiB +0.9%
Dependencies diff ```diff └─ sudo-rs [v0.2.0-dev.20230627] ├─ glob [v0.3.1] ├─ libc [v0.2.147] ├─ log [v0.4.19] ├─ signal-hook [v0.3.15] | ├─ libc [v0.2.147] | ├─ signal-hook-registry [v1.4.1] | | └─ libc [v0.2.147] | └─ cc [v1.0.79] └─ signal-hook-registry [v1.4.1] ```
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 96.34% and project coverage change: +0.07 :tada:

Comparison is base (6916363) 86.25% compared to head (16876e1) 86.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #611 +/- ## ========================================== + Coverage 86.25% 86.33% +0.07% ========================================== Files 62 62 Lines 8440 8480 +40 ========================================== + Hits 7280 7321 +41 + Misses 1160 1159 -1 ``` | [Impacted Files](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety) | Coverage Δ | | |---|---|---| | [src/log/mod.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2xvZy9tb2QucnM=) | `85.71% <ø> (ø)` | | | [src/exec/use\_pty/pipe.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9waXBlLnJz) | `95.97% <95.89%> (+2.33%)` | :arrow_up: | | [src/exec/event.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvZXZlbnQucnM=) | `83.13% <100.00%> (+0.20%)` | :arrow_up: | | [src/exec/no\_pty.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvbm9fcHR5LnJz) | `71.12% <100.00%> (+0.70%)` | :arrow_up: | | [src/exec/use\_pty/monitor.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9tb25pdG9yLnJz) | `54.91% <100.00%> (+0.40%)` | :arrow_up: | | [src/exec/use\_pty/parent.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL2V4ZWMvdXNlX3B0eS9wYXJlbnQucnM=) | `74.40% <100.00%> (+0.23%)` | :arrow_up: | | [src/system/poll.rs](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety#diff-c3JjL3N5c3RlbS9wb2xsLnJz) | `98.07% <100.00%> (+1.92%)` | :arrow_up: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/memorysafety/sudo-rs/pull/611/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=memorysafety)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.