Merge pull request #132 from Team-LJY/fix/extract-spool-destination
압축 풀기 임시 파일을 풀 위치 폴더에 만들고 할당량 초과를 공간 부족으로 안내
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
a7cc0f5c59a1c17ee58584009e6d6f1d20b99b76
변경된 파일 13개
+505-34| @@ -66,6 +66,9 @@ cargo +1.99.1 build --locked --manifest-path experiments/rust-ui-memory-app/Carg | ||
| 66 | 66 | - create-complete: ZIP 만들기 완료. 압축 해제 완료와 다른 문구를 확인한다. |
| 67 | 67 | - folder-empty: 빈 하위 폴더. 목록의 빈 폴더 안내를 확인한다. |
| 68 | 68 | - gzip-conflict: 단일 GZ 이름 충돌. 다른 이름으로 저장 버튼과 안내를 확인한다. |
| 69 | 추가: - extract-disk-full: 압축 해제의 원본 사본 또는 단계 임시 파일을 쓰는 도중 디스크 공간이나 할당량이 부족한 상황입니다. 공간 확보 후 재시도 안내와 "아무 파일도 풀지 않았습니다"를 확인합니다. ZIP 만들기 화면이 아닌 압축 해제 실패 화면이어야 합니다. | |
| 70 | 추가: - extract-complete-cleanup-failed: 압축 해제와 파일 저장은 완료됐지만 출력 폴더의 임시 파일 정리에 실패한 상황입니다. "압축을 풀었습니다"와 저장 위치를 유지하면서 임시 파일이 남을 수 있다는 경고가 함께 표시되는지 확인합니다. 해제 실패나 출력 없음으로 안내하지 않아야 합니다. | |
| 71 | 추가: - extract-cleanup-failed: 압축 해제 실패 뒤 출력 폴더의 임시 파일 이름을 지우지 못한 상황입니다. 파일 접근 오류와 함께 풀 위치 폴더에 임시 파일이 남을 수 있다는 경고를 확인합니다. 게시된 파일이 없어도 정리 실패를 표시하며, "아무 파일도 풀지 않았습니다"로 잔여 파일이 없다고 단정하지 않아야 합니다. | |
| 69 | 72 | - extract-partial: 일부 추출 후 실패. 이미 풀린 파일이 남는다는 경고를 확인한다. |
| 70 | 73 | - extract-uncertain: 저장 여부 불확실. 결과 확인을 권하는 경고를 확인한다. |
| 71 | 74 | - extract-unsynced: 완료 뒤 저장 확인 미완료. 완료 안내를 유지하고 자세히 보기에 경고가 있는지 확인한다. |
| @@ -319,6 +319,34 @@ mod platform { | ||
| 319 | 319 | pub fn create(&self, n: &str) -> std::io::Result<File> { |
| 320 | 320 | open(&self.file, std::ffi::OsStr::new(n), 1 | 0x40 | 0x80) |
| 321 | 321 | } |
| 322 | 추가: /// 이 폴더 안에 이름 없는 읽기/쓰기 임시 파일을 만듦. 마지막 핸들을 닫으면 제거됨. | |
| 323 | 추가: pub(crate) fn temporary(&self) -> Result<File> { | |
| 324 | 추가: // O_TMPFILE | O_EXCL: 이름이 생기지 않고 나중에 링크할 수도 없음. | |
| 325 | 추가: match open(&self.file, std::ffi::OsStr::new("."), 2 | 0x410000 | 0x80) { | |
| 326 | 추가: Ok(file) => return Ok(file), | |
| 327 | 추가: Err(e) => { | |
| 328 | 추가: if crate::space::io_error(e) == ErrorCode::DiskFull { | |
| 329 | 추가: return Err(ErrorCode::DiskFull); | |
| 330 | 추가: } | |
| 331 | 추가: } | |
| 332 | 추가: } | |
| 333 | 추가: // O_TMPFILE을 지원하지 않는 파일 시스템은 숨김 이름으로 만든 즉시 이름을 지움. | |
| 334 | 추가: let n = format!(".zipelo-{}.tmp", crate::spool::random_name()?); | |
| 335 | 추가: let file = open(&self.file, std::ffi::OsStr::new(&n), 2 | 0x40 | 0x80) | |
| 336 | 추가: .map_err(crate::space::io_error)?; | |
| 337 | 추가: if !self.remove(&n) { | |
| 338 | 추가: // 핸들을 닫고 한 번 더 지움. 그래도 남으면 정리 실패로 기록해 결과에 알림. | |
| 339 | 추가: drop(file); | |
| 340 | 추가: if !self.remove(&n) && !self.absent(&n).unwrap_or(false) { | |
| 341 | 추가: crate::spool::note_leftover(); | |
| 342 | 추가: } | |
| 343 | 추가: return Err(ErrorCode::Io); | |
| 344 | 추가: } | |
| 345 | 추가: if file.metadata().map_err(|_| ErrorCode::Io)?.nlink() != 0 { | |
| 346 | 추가: return Err(ErrorCode::Io); | |
| 347 | 추가: } | |
| 348 | 추가: Ok(file) | |
| 349 | 추가: } | |
| 322 | 350 | pub fn link(&self, from: &str, to: &str) -> std::io::Result<()> { |
| 323 | 351 | let a = CString::new(from).unwrap(); |
| 324 | 352 | let b = CString::new(to).unwrap(); |
| @@ -478,6 +506,10 @@ mod platform { | ||
| 478 | 506 | .custom_flags(0x00200000) |
| 479 | 507 | .open(self.path.join(n)) |
| 480 | 508 | } |
| 509 | 추가: /// 이 폴더 안에 닫으면 지워지는 숨김 임시 파일을 만듦. | |
| 510 | 추가: pub(crate) fn temporary(&self) -> Result<File> { | |
| 511 | 추가: crate::spool::windows_temporary(&self.path, ".zipelo-", true) | |
| 512 | 추가: } | |
| 481 | 513 | pub fn link(&self, a: &str, b: &str) -> std::io::Result<()> { |
| 482 | 514 | std::fs::hard_link(self.path.join(a), self.path.join(b)) |
| 483 | 515 | } |
| @@ -586,6 +586,17 @@ impl<W: Write> Job<W> { | ||
| 586 | 586 | return Err(ErrorCode::InvalidRequest); |
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 추가: // 해제의 원본 사본과 단계 임시 파일은 출력 폴더에 둠. 폴더를 열 수 없으면 기존 위치를 | |
| 590 | 추가: // 쓰고, 오류는 아래의 원래 출력 폴더 확인 지점에서 같은 순서로 보고함. | |
| 591 | 추가: let _spool_location = match &start.action { | |
| 592 | 추가: Action::Extract { destination, .. } => destination | |
| 593 | 추가: .to_path() | |
| 594 | 추가: .ok() | |
| 595 | 추가: .and_then(|path| Dir::root(&path).ok()) | |
| 596 | 추가: .map(|root| crate::spool::place_in(&root)) | |
| 597 | 추가: .transpose()?, | |
| 598 | 추가: _ => None, | |
| 599 | 추가: }; | |
| 589 | 600 | if let Some(budget) = &self.budget { |
| 590 | 601 | let scope = ResourceScope { |
| 591 | 602 | output: budget.ceiling.output > budget.soft.output, |
| @@ -1248,6 +1259,10 @@ pub fn serve<R: Read + Send + 'static, W: Write + Send + 'static>( | ||
| 1248 | 1259 | Some(ErrorCode::Internal) |
| 1249 | 1260 | } |
| 1250 | 1261 | }; |
| 1262 | 추가: // 출력 폴더의 임시 파일 이름을 지우지 못했으면 남은 파일이 있다고 알림. | |
| 1263 | 추가: if crate::spool::take_leftover() { | |
| 1264 | 추가: context.terminal.cleanup = Cleanup::Failed; | |
| 1265 | 추가: } | |
| 1251 | 1266 | let mut state = state |
| 1252 | 1267 | .lock() |
| 1253 | 1268 | .map_err(|_| std::io::Error::other("worker state poisoned"))?; |
| @@ -123,13 +123,17 @@ pub(crate) fn available(file: &File) -> Result<u128> { | ||
| 123 | 123 | Ok(free as u128) |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 삭제: // 공간 부족만 전용 오류로 변환함. | |
| 126 | 추가: // 공간 부족만 전용 오류로 변환함. 사용자 디스크 할당량 초과(EDQUOT, Windows 1295)도 | |
| 127 | 추가: // 쓸 수 있는 공간이 없다는 뜻이므로 권한 오류가 아니라 공간 부족으로 알림. | |
| 127 | 128 | pub(crate) fn io_error(error: std::io::Error) -> ErrorCode { |
| 128 | 129 | #[cfg(windows)] |
| 129 | 삭제: if matches!(error.raw_os_error(), Some(39 | 112)) { | |
| 130 | 추가: if matches!(error.raw_os_error(), Some(39 | 112 | 1295)) { | |
| 130 | 131 | return ErrorCode::DiskFull; |
| 131 | 132 | } |
| 132 | 삭제: if error.kind() == std::io::ErrorKind::StorageFull { | |
| 133 | 추가: if matches!( | |
| 134 | 추가: error.kind(), | |
| 135 | 추가: std::io::ErrorKind::StorageFull | std::io::ErrorKind::QuotaExceeded | |
| 136 | 추가: ) { | |
| 133 | 137 | ErrorCode::DiskFull |
| 134 | 138 | } else { |
| 135 | 139 | ErrorCode::Io |
| @@ -8,7 +8,71 @@ use std::{ | ||
| 8 | 8 | |
| 9 | 9 | type Result<T> = std::result::Result<T, ErrorCode>; |
| 10 | 10 | |
| 11 | 추가: thread_local! { | |
| 12 | 추가: // 작업 스레드가 지정한 임시 파일 위치. 없으면 시스템 임시 폴더를 사용함. | |
| 13 | 추가: static LOCATION: std::cell::RefCell<Option<filesystem::Dir>> = | |
| 14 | 추가: const { std::cell::RefCell::new(None) }; | |
| 15 | 추가: // 출력 폴더에 이름 있는 임시 파일을 만든 뒤 이름을 지우지 못했는지 기록함. | |
| 16 | 추가: static LEFTOVER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; | |
| 17 | 추가: } | |
| 18 | 추가: | |
| 19 | 추가: /// 해제 작업의 임시 파일을 출력 폴더에 두도록 지정함. 반환값이 사라지면 해제됨. | |
| 20 | 추가: /// 작업은 한 스레드에서 실행되므로 다른 작업이나 시험에 섞이지 않음. | |
| 21 | 추가: pub(crate) struct Location(()); | |
| 22 | 추가: impl Drop for Location { | |
| 23 | 추가: fn drop(&mut self) { | |
| 24 | 추가: LOCATION.with(|location| *location.borrow_mut() = None); | |
| 25 | 추가: } | |
| 26 | 추가: } | |
| 27 | 추가: pub(crate) fn place_in(dir: &filesystem::Dir) -> Result<Location> { | |
| 28 | 추가: let dir = dir.duplicate()?; | |
| 29 | 추가: LOCATION.with(|location| *location.borrow_mut() = Some(dir)); | |
| 30 | 추가: LEFTOVER.with(|leftover| leftover.set(false)); | |
| 31 | 추가: Ok(Location(())) | |
| 32 | 추가: } | |
| 33 | 추가: | |
| 34 | 추가: /// 출력 폴더에 지우지 못한 임시 파일이 남았음을 기록함. Windows 임시 파일은 닫으면 지워지므로 | |
| 35 | 추가: /// Linux 대체 이름 경로에서만 사용함. | |
| 36 | 추가: #[cfg(target_os = "linux")] | |
| 37 | 추가: pub(crate) fn note_leftover() { | |
| 38 | 추가: LEFTOVER.with(|leftover| leftover.set(true)); | |
| 39 | 추가: } | |
| 40 | 추가: | |
| 41 | 추가: /// 작업 중 출력 폴더에 임시 파일이 남았는지 확인하고 기록을 비움. | |
| 42 | 추가: pub(crate) fn take_leftover() -> bool { | |
| 43 | 추가: LEFTOVER.with(|leftover| leftover.replace(false)) | |
| 44 | 추가: } | |
| 45 | 추가: | |
| 46 | 추가: pub(crate) fn random_name() -> Result<String> { | |
| 47 | 추가: let mut random = [0; 16]; | |
| 48 | 추가: crate::crypto::random(&mut random)?; | |
| 49 | 추가: Ok(random.iter().map(|b| format!("{b:02x}")).collect()) | |
| 50 | 추가: } | |
| 51 | 추가: | |
| 52 | 추가: /// 이름 없는 임시 파일을 만듦. 해제 작업에서는 출력 폴더에, 그 외에는 시스템 임시 폴더에 둠. | |
| 53 | 추가: /// 출력 폴더에 두면 공간 판단이 실제 출력 디스크와 같아지고 /tmp 크기나 할당량에 묶이지 않음. | |
| 54 | 추가: /// 출력 폴더에 만들지 못하면(읽기 전용, 공간 부족 등) 이 작업의 남은 임시 파일은 모두 | |
| 55 | 추가: /// 기존 시스템 임시 폴더에 둠. 그러면 동작과 오류 우선순위가 이전과 같아지며, 출력 폴더 | |
| 56 | 추가: /// 문제는 원래의 출력 확인 지점에서 보고됨. | |
| 11 | 57 | pub(crate) fn temporary() -> Result<File> { |
| 58 | 추가: let placed = | |
| 59 | 추가: LOCATION.with(|location| location.borrow().as_ref().map(filesystem::Dir::temporary)); | |
| 60 | 추가: let destination_full = matches!(&placed, Some(Err(ErrorCode::DiskFull))); | |
| 61 | 추가: match placed { | |
| 62 | 추가: Some(Ok(file)) => return Ok(file), | |
| 63 | 추가: Some(Err(_)) => LOCATION.with(|location| *location.borrow_mut() = None), | |
| 64 | 추가: None => {} | |
| 65 | 추가: } | |
| 66 | 추가: system_temporary().map_err(|error| { | |
| 67 | 추가: if destination_full { | |
| 68 | 추가: ErrorCode::DiskFull | |
| 69 | 추가: } else { | |
| 70 | 추가: error | |
| 71 | 추가: } | |
| 72 | 추가: }) | |
| 73 | 추가: } | |
| 74 | 추가: | |
| 75 | 추가: fn system_temporary() -> Result<File> { | |
| 12 | 76 | #[cfg(target_os = "linux")] |
| 13 | 77 | { |
| 14 | 78 | use std::os::unix::fs::OpenOptionsExt; |
| @@ -21,17 +85,13 @@ pub(crate) fn temporary() -> Result<File> { | ||
| 21 | 85 | .open(std::env::temp_dir()) |
| 22 | 86 | { |
| 23 | 87 | Ok(file) => return Ok(file), |
| 24 | 삭제: Err(ref error) if error.kind() == std::io::ErrorKind::StorageFull => { | |
| 25 | 삭제: return Err(ErrorCode::DiskFull); | |
| 88 | 추가: Err(error) => { | |
| 89 | 추가: if crate::space::io_error(error) == ErrorCode::DiskFull { | |
| 90 | 추가: return Err(ErrorCode::DiskFull); | |
| 91 | 추가: } | |
| 26 | 92 | } |
| 27 | 삭제: Err(_) => {} | |
| 28 | 93 | } |
| 29 | 삭제: let mut random = [0; 16]; | |
| 30 | 삭제: crate::crypto::random(&mut random)?; | |
| 31 | 삭제: let name = random | |
| 32 | 삭제: .iter() | |
| 33 | 삭제: .map(|b| format!("{b:02x}")) | |
| 34 | 삭제: .collect::<String>(); | |
| 94 | 추가: let name = random_name()?; | |
| 35 | 95 | let path = std::env::temp_dir().join(format!("zipelo-{name}.tmp")); |
| 36 | 96 | let file = OpenOptions::new() |
| 37 | 97 | .read(true) |
| @@ -50,26 +110,27 @@ pub(crate) fn temporary() -> Result<File> { | ||
| 50 | 110 | } |
| 51 | 111 | #[cfg(windows)] |
| 52 | 112 | { |
| 53 | 삭제: use std::os::windows::fs::OpenOptionsExt; | |
| 54 | 삭제: let mut random = [0; 16]; | |
| 55 | 삭제: crate::crypto::random(&mut random)?; | |
| 56 | 삭제: let name = random | |
| 57 | 삭제: .iter() | |
| 58 | 삭제: .map(|b| format!("{b:02x}")) | |
| 59 | 삭제: .collect::<String>(); | |
| 60 | 삭제: OpenOptions::new() | |
| 61 | 삭제: .read(true) | |
| 62 | 삭제: .write(true) | |
| 63 | 삭제: .create_new(true) | |
| 64 | 삭제: .share_mode(0) | |
| 65 | 삭제: .access_mode(0xc0010000) | |
| 66 | 삭제: .custom_flags(0x04000000 | 0x00200000) | |
| 67 | 삭제: .attributes(0x100) | |
| 68 | 삭제: .open(std::env::temp_dir().join(format!("zipelo-{name}.tmp"))) | |
| 69 | 삭제: .map_err(crate::space::io_error) | |
| 113 | 추가: windows_temporary(&std::env::temp_dir(), "zipelo-", false) | |
| 70 | 114 | } |
| 71 | 115 | } |
| 72 | 116 | |
| 117 | 추가: /// 닫으면 지워지는 Windows 임시 파일을 지정한 폴더에 만듦. 출력 폴더에서는 숨김 속성을 붙임. | |
| 118 | 추가: #[cfg(windows)] | |
| 119 | 추가: pub(crate) fn windows_temporary(parent: &Path, prefix: &str, hidden: bool) -> Result<File> { | |
| 120 | 추가: use std::os::windows::fs::OpenOptionsExt; | |
| 121 | 추가: let name = random_name()?; | |
| 122 | 추가: OpenOptions::new() | |
| 123 | 추가: .read(true) | |
| 124 | 추가: .write(true) | |
| 125 | 추가: .create_new(true) | |
| 126 | 추가: .share_mode(0) | |
| 127 | 추가: .access_mode(0xc0010000) | |
| 128 | 추가: .custom_flags(0x04000000 | 0x00200000) | |
| 129 | 추가: .attributes(if hidden { 0x100 | 0x2 } else { 0x100 }) | |
| 130 | 추가: .open(parent.join(format!("{prefix}{name}.tmp"))) | |
| 131 | 추가: .map_err(crate::space::io_error) | |
| 132 | 추가: } | |
| 133 | 추가: | |
| 73 | 134 | #[derive(Clone, Copy, Debug)] |
| 74 | 135 | pub(crate) enum Step { |
| 75 | 136 | Check, |
| @@ -2323,7 +2323,9 @@ impl ArchiveApp { | ||
| 2323 | 2323 | let success = self.model.confirmed |
| 2324 | 2324 | && self.model.error.is_none() |
| 2325 | 2325 | && t.as_ref().is_some_and(|t| t.outcome == Outcome::Completed) |
| 2326 | 삭제: && warnings.is_empty(); | |
| 2326 | 추가: && warnings | |
| 2327 | 추가: .iter() | |
| 2328 | 추가: .all(|warning| !creating && *warning == present::CLEANUP_WARNING); | |
| 2327 | 2329 | let durability_warning = t |
| 2328 | 2330 | .as_ref() |
| 2329 | 2331 | .filter(|_| self.model.confirmed && !listing) |
| @@ -164,6 +164,9 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 164 | 164 | "tar-bz2" | "tar-xz" => "읽어주세요.txt", |
| 165 | 165 | "folder-empty" => "이 폴더는 비어 있습니다", |
| 166 | 166 | "dialog-error" => "파일 선택 창을 열 수 없습니다", |
| 167 | 추가: "extract-complete-cleanup-failed" => "압축을 풀었습니다", | |
| 168 | 추가: "extract-disk-full" => "디스크 여유 공간이 부족합니다", | |
| 169 | 추가: "extract-cleanup-failed" => "풀 위치 폴더에 남은 임시 파일이 있을 수 있습니다", | |
| 167 | 170 | "extract-partial" => "일부 파일만 풀렸습니다", |
| 168 | 171 | "extract-uncertain" => "저장이 끝났는지 확인하지 못했습니다", |
| 169 | 172 | "extract-unsynced" => "파일을 디스크에 완전히 저장했는지 확인하지 못했습니다", |
| @@ -190,6 +193,75 @@ fn every_listed_scenario_draws_and_keeps_its_expected_screen() { | ||
| 190 | 193 | _ => "읽어주세요.txt", |
| 191 | 194 | }; |
| 192 | 195 | assert!(labels.contains(expected), "{}: {labels}", scenario.name); |
| 196 | 추가: if scenario.name == "extract-complete-cleanup-failed" { | |
| 197 | 추가: use zipelo_ui_memory_app::archive_ui::{ | |
| 198 | 추가: Cleanup, Disposition, Outcome, Publication, | |
| 199 | 추가: }; | |
| 200 | 추가: let terminal = app.model.terminal.as_ref().unwrap(); | |
| 201 | 추가: assert!(app.model.confirmed); | |
| 202 | 추가: assert_eq!(terminal.outcome, Outcome::Completed); | |
| 203 | 추가: assert_eq!(terminal.error, None); | |
| 204 | 추가: assert_eq!(terminal.publication, Publication::Complete); | |
| 205 | 추가: assert_eq!(terminal.cleanup, Cleanup::Failed); | |
| 206 | 추가: assert_eq!(terminal.created_count, app.model.outputs.len() as u64); | |
| 207 | 추가: assert!(app | |
| 208 | 추가: .model | |
| 209 | 추가: .outputs | |
| 210 | 추가: .iter() | |
| 211 | 추가: .all(|(_, state)| *state == Disposition::Created)); | |
| 212 | 추가: assert!(labels.contains("폴더에 저장했습니다"), "{labels}"); | |
| 213 | 추가: assert!(labels.contains("임시 파일을 지우지 못했습니다"), "{labels}"); | |
| 214 | 추가: assert!( | |
| 215 | 추가: labels.contains("풀 위치 폴더에 남은 임시 파일이 있을 수 있습니다"), | |
| 216 | 추가: "{labels}" | |
| 217 | 추가: ); | |
| 218 | 추가: assert!(!labels.contains("압축을 풀지 못했습니다"), "{labels}"); | |
| 219 | 추가: assert!(!labels.contains("아무 파일도 풀지 않았습니다"), "{labels}"); | |
| 220 | 추가: } | |
| 221 | 추가: if matches!( | |
| 222 | 추가: scenario.name, | |
| 223 | 추가: "extract-disk-full" | "extract-cleanup-failed" | |
| 224 | 추가: ) { | |
| 225 | 추가: use zipelo_ui_memory_app::archive_ui::{Cleanup, ErrorCode, Outcome, Publication}; | |
| 226 | 추가: let cleanup_failed = scenario.name == "extract-cleanup-failed"; | |
| 227 | 추가: let terminal = app.model.terminal.as_ref().unwrap(); | |
| 228 | 추가: assert!(app.model.confirmed); | |
| 229 | 추가: assert_eq!(terminal.outcome, Outcome::Failed); | |
| 230 | 추가: assert_eq!(terminal.publication, Publication::None); | |
| 231 | 추가: assert_eq!(terminal.created_count, 0); | |
| 232 | 추가: assert_eq!(terminal.retained_partial_count, 0); | |
| 233 | 추가: assert_eq!( | |
| 234 | 추가: terminal.error, | |
| 235 | 추가: Some(if cleanup_failed { | |
| 236 | 추가: ErrorCode::Io | |
| 237 | 추가: } else { | |
| 238 | 추가: ErrorCode::DiskFull | |
| 239 | 추가: }) | |
| 240 | 추가: ); | |
| 241 | 추가: assert_eq!( | |
| 242 | 추가: terminal.cleanup, | |
| 243 | 추가: if cleanup_failed { | |
| 244 | 추가: Cleanup::Failed | |
| 245 | 추가: } else { | |
| 246 | 추가: Cleanup::Complete | |
| 247 | 추가: } | |
| 248 | 추가: ); | |
| 249 | 추가: assert!(labels.contains("압축을 풀지 못했습니다"), "{labels}"); | |
| 250 | 추가: assert!(!labels.contains("압축을 풀었습니다"), "{labels}"); | |
| 251 | 추가: assert_eq!( | |
| 252 | 추가: labels.contains("임시 파일을 지우지 못했습니다"), | |
| 253 | 추가: cleanup_failed | |
| 254 | 추가: ); | |
| 255 | 추가: if cleanup_failed { | |
| 256 | 추가: assert!(!labels.contains("아무 파일도 풀지 않았습니다"), "{labels}"); | |
| 257 | 추가: } else { | |
| 258 | 추가: assert!( | |
| 259 | 추가: labels.contains("공간을 확보한 뒤 다시 시도하세요"), | |
| 260 | 추가: "{labels}" | |
| 261 | 추가: ); | |
| 262 | 추가: assert!(labels.contains("아무 파일도 풀지 않았습니다"), "{labels}"); | |
| 263 | 추가: } | |
| 264 | 추가: } | |
| 193 | 265 | if scenario.name == "extract-rename-failed" { |
| 194 | 266 | assert!(labels.contains("파일을 읽거나 쓰지 못했습니다"), "{labels}"); |
| 195 | 267 | assert!(!labels.contains("이름 바꿔 저장:"), "{labels}"); |
| @@ -90,6 +90,9 @@ catalog! { | ||
| 90 | 90 | "create-complete" => "ZIP 만들기 완료", |
| 91 | 91 | "folder-empty" => "항목이 없는 하위 폴더", |
| 92 | 92 | "gzip-conflict" => "단일 GZ 파일 이름 충돌", |
| 93 | 추가: "extract-disk-full" => "압축 해제 중 디스크 공간 또는 할당량 부족", | |
| 94 | 추가: "extract-complete-cleanup-failed" => "압축 해제 완료와 출력 폴더의 임시 파일 정리 실패", | |
| 95 | 추가: "extract-cleanup-failed" => "압축 해제 실패와 출력 폴더의 임시 파일 정리 실패", | |
| 93 | 96 | "extract-partial" => "일부 파일만 풀린 결과", |
| 94 | 97 | "extract-uncertain" => "저장 여부를 확인할 수 없는 결과", |
| 95 | 98 | "extract-unsynced" => "완료 뒤 저장 확인 경고의 상세 정보", |
| @@ -902,7 +905,8 @@ impl Scenario { | ||
| 902 | 905 | "extract-complete" |
| 903 | 906 | | "create-complete" |
| 904 | 907 | | "create-sevenzip-complete" |
| 905 | 삭제: | "extract-unsynced" => { | |
| 908 | 추가: | "extract-unsynced" | |
| 909 | 추가: | "extract-complete-cleanup-failed" => { | |
| 906 | 910 | let names = app.targets.as_ref().unwrap(); |
| 907 | 911 | for name in names { |
| 908 | 912 | state.frame(Event::Output { |
| @@ -922,7 +926,11 @@ impl Scenario { | ||
| 922 | 926 | } else { |
| 923 | 927 | Durability::Synced |
| 924 | 928 | }, |
| 925 | 삭제: cleanup: Cleanup::Complete, | |
| 929 | 추가: cleanup: if self.name == "extract-complete-cleanup-failed" { | |
| 930 | 추가: Cleanup::Failed | |
| 931 | 추가: } else { | |
| 932 | 추가: Cleanup::Complete | |
| 933 | 추가: }, | |
| 926 | 934 | })); |
| 927 | 935 | state.queue.extend([ |
| 928 | 936 | HostEvent::StdoutEof, |
| @@ -961,6 +969,30 @@ impl Scenario { | ||
| 961 | 969 | HostEvent::Exited { success: true }, |
| 962 | 970 | ]); |
| 963 | 971 | } |
| 972 | 추가: "extract-disk-full" | "extract-cleanup-failed" => { | |
| 973 | 추가: state.frame(Event::Terminal(Terminal { | |
| 974 | 추가: outcome: Outcome::Failed, | |
| 975 | 추가: error: Some(if self.name == "extract-disk-full" { | |
| 976 | 추가: ErrorCode::DiskFull | |
| 977 | 추가: } else { | |
| 978 | 추가: ErrorCode::Io | |
| 979 | 추가: }), | |
| 980 | 추가: publication: Publication::None, | |
| 981 | 추가: created_count: 0, | |
| 982 | 추가: retained_partial_count: 0, | |
| 983 | 추가: durability: Durability::NotApplicable, | |
| 984 | 추가: cleanup: if self.name == "extract-cleanup-failed" { | |
| 985 | 추가: Cleanup::Failed | |
| 986 | 추가: } else { | |
| 987 | 추가: Cleanup::Complete | |
| 988 | 추가: }, | |
| 989 | 추가: })); | |
| 990 | 추가: state.queue.extend([ | |
| 991 | 추가: HostEvent::StdoutEof, | |
| 992 | 추가: HostEvent::StderrEof, | |
| 993 | 추가: HostEvent::Exited { success: true }, | |
| 994 | 추가: ]); | |
| 995 | 추가: } | |
| 964 | 996 | "conflict" |
| 965 | 997 | | "gzip-conflict" |
| 966 | 998 | | "unsupported" |
| @@ -820,6 +820,30 @@ mod linux { | ||
| 820 | 820 | assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}"); |
| 821 | 821 | assert!(s.0.join("paused").exists()); |
| 822 | 822 | assert_eq!(fs::read_dir(s.0.join("staging")).unwrap().count(), 0); |
| 823 | 추가: // 출력 폴더의 이름 있는 대체 임시 파일도 사용 전에 이름이 지워져야 함. | |
| 824 | 추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 1); | |
| 825 | 추가: assert_zero_file(&s.0.join("output/payload.bin"), 1024 * 1024); | |
| 826 | 추가: } | |
| 827 | 추가: #[test] | |
| 828 | 추가: fn destination_fallback_unlink_failure_reports_cleanup_and_moves_to_system_temp() { | |
| 829 | 추가: let s = Scratch::new(); | |
| 830 | 추가: generate(&s, "store", 1024 * 1024); | |
| 831 | 추가: let request = start(&s, false, Limits::default().output); | |
| 832 | 추가: let child = spawn(&s, request, Some("fallback-unlink-denied")); | |
| 833 | 추가: assert_eq!(wait(child.id()).0, 0); | |
| 834 | 추가: let events = events(&s); | |
| 835 | 추가: let t = terminal(&events); | |
| 836 | 추가: // 이름을 지우지 못한 대체 임시 파일은 정리 실패로 알리고, 남은 작업은 시스템 임시 폴더에서 계속함. | |
| 837 | 추가: assert_eq!(t.outcome, Outcome::Completed, "{events:?}"); | |
| 838 | 추가: assert_eq!(t.cleanup, Cleanup::Failed, "{events:?}"); | |
| 839 | 추가: assert!(s.0.join("paused").exists()); | |
| 840 | 추가: let leftovers = fs::read_dir(s.0.join("output")) | |
| 841 | 추가: .unwrap() | |
| 842 | 추가: .map(|entry| entry.unwrap().file_name().into_string().unwrap()) | |
| 843 | 추가: .filter(|name| name.starts_with(".zipelo-")) | |
| 844 | 추가: .count(); | |
| 845 | 추가: assert_eq!(leftovers, 1, "첫 시도의 대체 임시 파일 하나만 남아야 함"); | |
| 846 | 추가: assert_eq!(fs::read_dir(s.0.join("staging")).unwrap().count(), 0); | |
| 823 | 847 | assert_zero_file(&s.0.join("output/payload.bin"), 1024 * 1024); |
| 824 | 848 | } |
| 825 | 849 | struct Subreaper(i32); |
| @@ -26,6 +26,15 @@ __attribute__((constructor)) static void initialize(void) { | ||
| 26 | 26 | real_fstatvfs = dlsym(RTLD_NEXT, "fstatvfs"); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 추가: /* 출력 폴더 임시 파일의 대체 이름(.zipelo-<hex 32>.tmp). 게시 임시 이름(.zipelo-<pid>-<n>.tmp)은 제외함. */ | |
| 30 | 추가: static int spool_name(const char *path) { | |
| 31 | 추가: size_t length = strlen(path); | |
| 32 | 추가: if (length != 44 || strncmp(path, ".zipelo-", 8) || strcmp(path + 40, ".tmp")) return 0; | |
| 33 | 추가: for (size_t i = 8; i < 40; i++) | |
| 34 | 추가: if (!strchr("0123456789abcdef", path[i])) return 0; | |
| 35 | 추가: return 1; | |
| 36 | 추가: } | |
| 37 | 추가: | |
| 29 | 38 | static int output_file(int fd) { |
| 30 | 39 | char link[64], path[4096]; |
| 31 | 40 | snprintf(link, sizeof(link), "/proc/self/fd/%d", fd); |
| @@ -39,18 +48,40 @@ static int output_file(int fd) { | ||
| 39 | 48 | |
| 40 | 49 | int openat(int fd, const char *path, int flags, ...) { |
| 41 | 50 | mode_t mode = 0; |
| 42 | 삭제: if (flags & O_CREAT) { | |
| 51 | 추가: if ((flags & O_CREAT) || ((flags & O_TMPFILE) == O_TMPFILE)) { | |
| 43 | 52 | va_list args; |
| 44 | 53 | va_start(args, flags); |
| 45 | 54 | mode = va_arg(args, unsigned int); |
| 46 | 55 | va_end(args); |
| 47 | 56 | } |
| 48 | 57 | const char *fault = getenv("ZIPELO_TEST_FAULT"); |
| 58 | 추가: if (fault && !strncmp(fault, "destination-", 12) | |
| 59 | 추가: && (((flags & O_TMPFILE) == O_TMPFILE) || ((flags & O_CREAT) && spool_name(path)))) { | |
| 60 | 추가: if (strstr(fault, "named") && (flags & O_TMPFILE) == O_TMPFILE) { | |
| 61 | 추가: errno = EOPNOTSUPP; | |
| 62 | 추가: } else { | |
| 63 | 추가: errno = strstr(fault, "edquot") ? EDQUOT : strstr(fault, "denied") ? EACCES : ENOSPC; | |
| 64 | 추가: } | |
| 65 | 추가: return -1; | |
| 66 | 추가: } | |
| 49 | 67 | if (fault && (!strcmp(fault, "create-full") || !strcmp(fault, "create-denied")) |
| 50 | 68 | && !strncmp(path, ".zipelo-", 8)) { |
| 51 | 69 | errno = !strcmp(fault, "create-full") ? ENOSPC : EACCES; |
| 52 | 70 | return -1; |
| 53 | 71 | } |
| 72 | 추가: /* 해제 작업의 원본 사본과 단계 임시 파일은 출력 폴더 핸들 기준 O_TMPFILE로 만듦. */ | |
| 73 | 추가: if ((flags & O_TMPFILE) == O_TMPFILE) { | |
| 74 | 추가: if (fault && !strcmp(fault, "temp-full")) { | |
| 75 | 추가: errno = ENOSPC; | |
| 76 | 추가: return -1; | |
| 77 | 추가: } | |
| 78 | 추가: if (fault && (!strcmp(fault, "fallback") || !strcmp(fault, "fallback-unlink-denied"))) { | |
| 79 | 추가: int marker = real_openat(AT_FDCWD, getenv("ZIPELO_TEST_MARKER"), O_CREAT | O_WRONLY, 0600); | |
| 80 | 추가: if (marker >= 0) close(marker); | |
| 81 | 추가: errno = EOPNOTSUPP; | |
| 82 | 추가: return -1; | |
| 83 | 추가: } | |
| 84 | 추가: } | |
| 54 | 85 | return real_openat(fd, path, flags, mode); |
| 55 | 86 | } |
| 56 | 87 | |
| @@ -180,6 +211,10 @@ int unlinkat(int fd, const char *path, int flags) { | ||
| 180 | 211 | errno = EACCES; |
| 181 | 212 | return -1; |
| 182 | 213 | } |
| 214 | 추가: if (fault && !strcmp(fault, "fallback-unlink-denied") && spool_name(path)) { | |
| 215 | 추가: errno = EACCES; | |
| 216 | 추가: return -1; | |
| 217 | 추가: } | |
| 183 | 218 | int (*real_unlinkat)(int, const char *, int) = dlsym(RTLD_NEXT, "unlinkat"); |
| 184 | 219 | return real_unlinkat(fd, path, flags); |
| 185 | 220 | } |
| @@ -1634,3 +1634,6 @@ mod recovery; | ||
| 1634 | 1634 | |
| 1635 | 1635 | #[cfg(target_os = "linux")] |
| 1636 | 1636 | mod partial_output; |
| 1637 | 추가: | |
| 1638 | 추가: #[cfg(target_os = "linux")] | |
| 1639 | 추가: mod spool_location; |
| @@ -4,6 +4,10 @@ use std::io::{Error, ErrorKind}; | ||
| 4 | 4 | #[test] |
| 5 | 5 | fn storage_full_is_distinct_from_other_io_errors() { |
| 6 | 6 | assert_eq!(io_error(ErrorKind::StorageFull.into()), ErrorCode::DiskFull); |
| 7 | 추가: assert_eq!( | |
| 8 | 추가: io_error(ErrorKind::QuotaExceeded.into()), | |
| 9 | 추가: ErrorCode::DiskFull | |
| 10 | 추가: ); | |
| 7 | 11 | for kind in [ |
| 8 | 12 | ErrorKind::PermissionDenied, |
| 9 | 13 | ErrorKind::Other, |
| @@ -17,6 +21,8 @@ fn storage_full_is_distinct_from_other_io_errors() { | ||
| 17 | 21 | #[test] |
| 18 | 22 | fn native_linux_enospc_is_disk_full() { |
| 19 | 23 | assert_eq!(io_error(Error::from_raw_os_error(28)), ErrorCode::DiskFull); |
| 24 | 추가: // EDQUOT: tmpfs usrquota 등 사용자 할당량 초과도 권한 오류로 안내하지 않음. | |
| 25 | 추가: assert_eq!(io_error(Error::from_raw_os_error(122)), ErrorCode::DiskFull); | |
| 20 | 26 | for code in [5, 13, 39, 112] { |
| 21 | 27 | assert_eq!(io_error(Error::from_raw_os_error(code)), ErrorCode::Io); |
| 22 | 28 | } |
| @@ -25,7 +31,7 @@ fn native_linux_enospc_is_disk_full() { | ||
| 25 | 31 | #[cfg(windows)] |
| 26 | 32 | #[test] |
| 27 | 33 | fn native_windows_disk_full_codes_are_distinct_from_access_denied() { |
| 28 | 삭제: for code in [39, 112] { | |
| 34 | 추가: for code in [39, 112, 1295] { | |
| 29 | 35 | assert_eq!( |
| 30 | 36 | io_error(Error::from_raw_os_error(code)), |
| 31 | 37 | ErrorCode::DiskFull |
| @@ -0,0 +1,182 @@ | ||
| 1 | 추가: use super::*; | |
| 2 | 추가: | |
| 3 | 추가: // 해제 작업의 원본 사본과 단계 임시 파일은 시스템 임시 폴더가 아니라 출력 폴더에 둠. | |
| 4 | 추가: // 시스템 임시 폴더를 쓸 수 없게 만들어도(/tmp 할당량 초과와 같은 상황) 해제가 성공해야 함. | |
| 5 | 추가: fn extract_without_system_temp(bytes: &[u8]) -> (Scratch, Vec<Message>) { | |
| 6 | 추가: extract_unusable_system_temp(bytes, None, false) | |
| 7 | 추가: } | |
| 8 | 추가: fn extract_unusable_system_temp( | |
| 9 | 추가: bytes: &[u8], | |
| 10 | 추가: fault: Option<&str>, | |
| 11 | 추가: file_at_temp_path: bool, | |
| 12 | 추가: ) -> (Scratch, Vec<Message>) { | |
| 13 | 추가: let s = Scratch::new(); | |
| 14 | 추가: let start = encrypted_start(&s, bytes); | |
| 15 | 추가: let temp = s.0.join("missing-temp"); | |
| 16 | 추가: if file_at_temp_path { | |
| 17 | 추가: fs::write(&temp, b"keep").unwrap(); | |
| 18 | 추가: } | |
| 19 | 추가: let mut command = s.worker(); | |
| 20 | 추가: command.env("TMPDIR", &temp); | |
| 21 | 추가: if let Some(fault) = fault { | |
| 22 | 추가: let shim = s.0.join("io_fault.so"); | |
| 23 | 추가: assert!( | |
| 24 | 추가: Command::new("cc") | |
| 25 | 추가: .args(["-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror"]) | |
| 26 | 추가: .arg( | |
| 27 | 추가: PathBuf::from(env!("CARGO_MANIFEST_DIR")) | |
| 28 | 추가: .join("../../tests/rust-archive-worker/io_fault.c") | |
| 29 | 추가: ) | |
| 30 | 추가: .args(["-ldl", "-o"]) | |
| 31 | 추가: .arg(&shim) | |
| 32 | 추가: .status() | |
| 33 | 추가: .unwrap() | |
| 34 | 추가: .success() | |
| 35 | 추가: ); | |
| 36 | 추가: command | |
| 37 | 추가: .env("LD_PRELOAD", shim) | |
| 38 | 추가: .env("ZIPELO_TEST_FAULT", fault); | |
| 39 | 추가: } | |
| 40 | 추가: let mut child = command | |
| 41 | 추가: .stdin(Stdio::piped()) | |
| 42 | 추가: .stdout(Stdio::piped()) | |
| 43 | 추가: .stderr(Stdio::piped()) | |
| 44 | 추가: .spawn() | |
| 45 | 추가: .unwrap(); | |
| 46 | 추가: let mut writer = Some(Writer::new(child.stdin.take().unwrap(), 17)); | |
| 47 | 추가: writer | |
| 48 | 추가: .as_mut() | |
| 49 | 추가: .unwrap() | |
| 50 | 추가: .send(&Message::StartInteractive(start)) | |
| 51 | 추가: .unwrap(); | |
| 52 | 추가: let mut reader = Reader::new(child.stdout.take().unwrap()); | |
| 53 | 추가: let mut events = Vec::new(); | |
| 54 | 추가: while let Some((job, _, event)) = reader.read().unwrap() { | |
| 55 | 추가: assert_eq!(job, 17); | |
| 56 | 추가: if let Message::PasswordRequired { challenge_id, .. } = &event { | |
| 57 | 추가: for reply in password_reply(*challenge_id, TEST_PASSWORD) { | |
| 58 | 추가: writer.as_mut().unwrap().send(&reply).unwrap(); | |
| 59 | 추가: } | |
| 60 | 추가: } | |
| 61 | 추가: if matches!(event, Message::Terminal(_)) { | |
| 62 | 추가: writer = None; | |
| 63 | 추가: } | |
| 64 | 추가: events.push(event); | |
| 65 | 추가: } | |
| 66 | 추가: drop(writer); | |
| 67 | 추가: let output = child.wait_with_output().unwrap(); | |
| 68 | 추가: assert!(output.status.success(), "{:?}", output.stderr); | |
| 69 | 추가: assert!(output.stderr.is_empty()); | |
| 70 | 추가: if file_at_temp_path { | |
| 71 | 추가: assert_eq!(fs::read(&temp).unwrap(), b"keep"); | |
| 72 | 추가: } else { | |
| 73 | 추가: assert!(!temp.exists()); | |
| 74 | 추가: } | |
| 75 | 추가: (s, events) | |
| 76 | 추가: } | |
| 77 | 추가: | |
| 78 | 추가: fn assert_only_outputs(s: &Scratch, expected: &[&str]) { | |
| 79 | 추가: let mut names = fs::read_dir(s.0.join("output")) | |
| 80 | 추가: .unwrap() | |
| 81 | 추가: .map(|entry| entry.unwrap().file_name().into_string().unwrap()) | |
| 82 | 추가: .collect::<Vec<_>>(); | |
| 83 | 추가: names.sort(); | |
| 84 | 추가: assert_eq!(names, expected, "임시 파일이 출력 폴더에 남으면 안 됨"); | |
| 85 | 추가: } | |
| 86 | 추가: | |
| 87 | 추가: #[test] | |
| 88 | 추가: fn extract_spools_in_destination_when_system_temp_is_unusable() { | |
| 89 | 추가: let (s, events) = extract_without_system_temp(include_bytes!("fixtures/deflate.zip")); | |
| 90 | 추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}"); | |
| 91 | 추가: assert_eq!(terminal(&events).publication, Publication::Complete); | |
| 92 | 추가: assert_eq!( | |
| 93 | 추가: fs::read(s.0.join("output/folder/hello.txt")).unwrap(), | |
| 94 | 추가: PAYLOAD | |
| 95 | 추가: ); | |
| 96 | 추가: assert_only_outputs(&s, &["empty", "folder"]); | |
| 97 | 추가: } | |
| 98 | 추가: | |
| 99 | 추가: #[test] | |
| 100 | 추가: fn encrypted_extract_spools_in_destination_when_system_temp_is_unusable() { | |
| 101 | 추가: let (s, events) = extract_without_system_temp(AES_ZIP); | |
| 102 | 추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}"); | |
| 103 | 추가: assert_eq!( | |
| 104 | 추가: fs::read(s.0.join("output/payload.bin")).unwrap(), | |
| 105 | 추가: ENCRYPTED_PAYLOAD | |
| 106 | 추가: ); | |
| 107 | 추가: assert_only_outputs(&s, &["payload.bin"]); | |
| 108 | 추가: } | |
| 109 | 추가: | |
| 110 | 추가: #[test] | |
| 111 | 추가: fn corrupt_archive_error_wins_over_read_only_destination() { | |
| 112 | 추가: // 출력 폴더에 임시 파일을 만들 수 없으면 시스템 임시 폴더를 써서 기존 오류 우선순위를 유지함. | |
| 113 | 추가: // 손상된 압축파일은 권한 문제가 아니라 손상으로 안내해야 함. | |
| 114 | 추가: let bytes = seven_fixture("bad-trailing.7z"); | |
| 115 | 추가: let writable = Scratch::new(); | |
| 116 | 추가: let baseline = extract( | |
| 117 | 추가: &writable, | |
| 118 | 추가: &bytes, | |
| 119 | 추가: None, | |
| 120 | 추가: Selection::All, | |
| 121 | 추가: None, | |
| 122 | 추가: Limits::default(), | |
| 123 | 추가: ); | |
| 124 | 추가: assert_eq!(terminal(&baseline).error, ErrorCode::Integrity); | |
| 125 | 추가: | |
| 126 | 추가: use std::os::unix::fs::PermissionsExt; | |
| 127 | 추가: let s = Scratch::new(); | |
| 128 | 추가: let output = s.0.join("output"); | |
| 129 | 추가: fs::create_dir(&output).unwrap(); | |
| 130 | 추가: fs::set_permissions(&output, fs::Permissions::from_mode(0o500)).unwrap(); | |
| 131 | 추가: let events = extract(&s, &bytes, None, Selection::All, None, Limits::default()); | |
| 132 | 추가: fs::set_permissions(&output, fs::Permissions::from_mode(0o700)).unwrap(); | |
| 133 | 추가: assert_eq!(terminal(&events).error, ErrorCode::Integrity, "{events:?}"); | |
| 134 | 추가: assert_eq!(terminal(&events).publication, Publication::None); | |
| 135 | 추가: assert_eq!(terminal(&events).cleanup, Cleanup::Complete); | |
| 136 | 추가: assert_eq!(fs::read_dir(&output).unwrap().count(), 0); | |
| 137 | 추가: } | |
| 138 | 추가: | |
| 139 | 추가: #[test] | |
| 140 | 추가: fn destination_space_or_quota_failure_survives_unusable_system_temp() { | |
| 141 | 추가: let input = include_bytes!("fixtures/deflate.zip"); | |
| 142 | 추가: for fault in [ | |
| 143 | 추가: "destination-enospc", | |
| 144 | 추가: "destination-edquot", | |
| 145 | 추가: "destination-named-enospc", | |
| 146 | 추가: "destination-named-edquot", | |
| 147 | 추가: ] { | |
| 148 | 추가: for file in [false, true] { | |
| 149 | 추가: let (s, events) = extract_unusable_system_temp(input, Some(fault), file); | |
| 150 | 추가: let terminal = terminal(&events); | |
| 151 | 추가: assert_eq!( | |
| 152 | 추가: terminal.outcome, | |
| 153 | 추가: Outcome::Failed, | |
| 154 | 추가: "{fault}/{file}: {events:?}" | |
| 155 | 추가: ); | |
| 156 | 추가: assert_eq!( | |
| 157 | 추가: terminal.error, | |
| 158 | 추가: ErrorCode::DiskFull, | |
| 159 | 추가: "{fault}/{file}: {events:?}" | |
| 160 | 추가: ); | |
| 161 | 추가: assert_eq!(terminal.publication, Publication::None); | |
| 162 | 추가: assert_eq!(terminal.cleanup, Cleanup::Complete); | |
| 163 | 추가: assert_eq!(terminal.created_count, 0); | |
| 164 | 추가: assert_only_outputs(&s, &[]); | |
| 165 | 추가: assert_eq!(fs::read(s.0.join("input")).unwrap(), input); | |
| 166 | 추가: } | |
| 167 | 추가: } | |
| 168 | 추가: } | |
| 169 | 추가: | |
| 170 | 추가: #[test] | |
| 171 | 추가: fn destination_permission_failure_with_unusable_system_temp_stays_io() { | |
| 172 | 추가: for file in [false, true] { | |
| 173 | 추가: let (s, events) = extract_unusable_system_temp( | |
| 174 | 추가: include_bytes!("fixtures/deflate.zip"), | |
| 175 | 추가: Some("destination-denied"), | |
| 176 | 추가: file, | |
| 177 | 추가: ); | |
| 178 | 추가: assert_eq!(terminal(&events).error, ErrorCode::Io, "{events:?}"); | |
| 179 | 추가: assert_eq!(terminal(&events).outcome, Outcome::Failed); | |
| 180 | 추가: assert_only_outputs(&s, &[]); | |
| 181 | 추가: } | |
| 182 | 추가: } |