Repository navigation
fix: release review follow-ups (release-review) #3423
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3791944
fix: release review follow-ups (release-review)
giswqs 11c26ab
fix: say or refuse every cut pipe and coded entry (review)
giswqs 7851bda
fix: refuse a non-text domain description; a tile cache's code falls …
giswqs 33e5712
Merge remote-tracking branch 'origin/main' into sweep/2026-11-29-rele…
giswqs b728437
fix: an ArcGIS extent keeps to its first readable code; texture names…
giswqs 032e318
fix: review follow-ups on pipe, parquet, texture and STAC index wording
giswqs 4e069fc
fix: a refused program output names a way out; texture limit tested f…
giswqs 83c1873
fix: a pipe reader that stops is an error; the runner names a way out
giswqs 4f08e22
fix(geolibre): a manifests query that fails says why
giswqs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //! Reading what a program started on the desktop prints, within a limit. | ||
|
|
||
| /// The most of a program's standard output, and of its standard error, that is kept. | ||
| pub const PIPE_LIMIT: u64 = 64 << 20; | ||
|
|
||
| /// What ends a program's messages cut at their limit ([`marked_cut`]). | ||
| pub const CUT: &[u8] = b"\n(cut)"; | ||
|
|
||
| /// `text` kept to `limit` bytes and ended with [`CUT`] when `cut`: for messages that are only | ||
| /// shown, so a cut is said rather than refused. | ||
| pub fn marked_cut(mut text: Vec<u8>, cut: bool, limit: u64) -> Vec<u8> { | ||
| if cut { | ||
| text.truncate(usize::try_from(limit).unwrap_or(usize::MAX).saturating_sub(CUT.len())); | ||
| text.extend_from_slice(CUT); | ||
| } | ||
| text | ||
| } | ||
|
|
||
| /// Reads `pipe` to its end on a thread of its own, keeping its first `limit` bytes and reading | ||
| /// the rest into the void, so a program that prints without end can't fill the memory, and | ||
| /// can't block on a full pipe either. The thread answers the bytes kept and whether any were | ||
| /// left out (or a read failed partway); a thread the system refuses is the error. | ||
| pub fn drain_bounded( | ||
| mut pipe: impl std::io::Read + Send + 'static, | ||
| limit: u64, | ||
| ) -> std::io::Result<std::thread::JoinHandle<(Vec<u8>, bool)>> { | ||
| use std::io::Read as _; | ||
| std::thread::Builder::new().spawn(move || { | ||
| let mut buf = Vec::new(); | ||
| let read = pipe.by_ref().take(limit).read_to_end(&mut buf); | ||
| let rest = std::io::copy(&mut pipe, &mut std::io::sink()); | ||
| // A pipe that fails partway counts as cut: what was kept may not be all it held. | ||
| (buf, read.is_err() || !matches!(rest, Ok(0))) | ||
| }) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| /// Exactly the limit is kept whole and said uncut; one byte more is cut to the limit and said. | ||
| #[test] | ||
| fn a_pipe_is_kept_to_its_limit_and_says_when_cut() { | ||
| let (kept, cut) = drain_bounded(std::io::Cursor::new(vec![7u8; 10]), 10).unwrap().join().unwrap(); | ||
| assert_eq!((kept.len(), cut), (10, false)); | ||
| let (kept, cut) = drain_bounded(std::io::Cursor::new(vec![7u8; 11]), 10).unwrap().join().unwrap(); | ||
| assert_eq!((kept.len(), cut), (10, true)); | ||
| assert_eq!(marked_cut(kept.clone(), false, 10), kept); | ||
| let marked = marked_cut(kept, true, 10); | ||
| assert!(marked.len() == 10 && marked.ends_with(CUT), "{marked:?}"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.