diff -Nru rust-remove-dir-all-0.5.1/Cargo.toml rust-remove-dir-all-0.5.2/Cargo.toml --- rust-remove-dir-all-0.5.1/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-remove-dir-all-0.5.2/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "remove_dir_all" -version = "0.5.1" +version = "0.5.2" authors = ["Aaronepower "] include = ["Cargo.toml", "LICENCE-APACHE", "LICENCE-MIT", "src/**/*"] description = "A safe, reliable implementation of remove_dir_all for Windows" @@ -20,7 +20,9 @@ keywords = ["utility", "filesystem", "remove_dir", "windows"] categories = ["filesystem"] license = "MIT/Apache-2.0" -repository = "https://github.com/Aaronepower/remove_dir_all.git" +repository = "https://github.com/XAMPPRocky/remove_dir_all.git" +[dev-dependencies.doc-comment] +version = "0.3" [target."cfg(windows)".dependencies.winapi] version = "0.3" features = ["std", "errhandlingapi", "winerror", "fileapi", "winbase"] diff -Nru rust-remove-dir-all-0.5.1/Cargo.toml.orig rust-remove-dir-all-0.5.2/Cargo.toml.orig --- rust-remove-dir-all-0.5.1/Cargo.toml.orig 2018-04-19 14:00:35.000000000 +0000 +++ rust-remove-dir-all-0.5.2/Cargo.toml.orig 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +1,28 @@ -[package] -authors = ["Aaronepower "] -description = "A safe, reliable implementation of remove_dir_all for Windows" -include = [ - "Cargo.toml", - "LICENCE-APACHE", - "LICENCE-MIT", - "src/**/*" -] -license = "MIT/Apache-2.0" -name = "remove_dir_all" -readme = "README.md" -repository = "https://github.com/Aaronepower/remove_dir_all.git" -version = "0.5.1" -keywords = ["utility", "filesystem", "remove_dir", "windows"] -categories = ["filesystem"] - -[target.'cfg(windows)'.dependencies] -winapi = { version = "0.3", features = ["std", "errhandlingapi", "winerror", "fileapi", "winbase"]} +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "remove_dir_all" +version = "0.5.2" +authors = ["Aaronepower "] +include = ["Cargo.toml", "LICENCE-APACHE", "LICENCE-MIT", "src/**/*"] +description = "A safe, reliable implementation of remove_dir_all for Windows" +readme = "README.md" +keywords = ["utility", "filesystem", "remove_dir", "windows"] +categories = ["filesystem"] +license = "MIT/Apache-2.0" +repository = "https://github.com/XAMPPRocky/remove_dir_all.git" +[dev-dependencies.doc-comment] +version = "0.3" +[target."cfg(windows)".dependencies.winapi] +version = "0.3" +features = ["std", "errhandlingapi", "winerror", "fileapi", "winbase"] diff -Nru rust-remove-dir-all-0.5.1/.cargo_vcs_info.json rust-remove-dir-all-0.5.2/.cargo_vcs_info.json --- rust-remove-dir-all-0.5.1/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 +++ rust-remove-dir-all-0.5.2/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "07f98f0fffe3d2dd540f89716ae9803360583198" + } +} diff -Nru rust-remove-dir-all-0.5.1/debian/cargo-checksum.json rust-remove-dir-all-0.5.2/debian/cargo-checksum.json --- rust-remove-dir-all-0.5.1/debian/cargo-checksum.json 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/cargo-checksum.json 2019-07-07 08:32:42.000000000 +0000 @@ -1 +1 @@ -{"package":"3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5","files":{}} +{"package":"4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e","files":{}} diff -Nru rust-remove-dir-all-0.5.1/debian/changelog rust-remove-dir-all-0.5.2/debian/changelog --- rust-remove-dir-all-0.5.1/debian/changelog 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/changelog 2019-07-07 08:32:42.000000000 +0000 @@ -1,3 +1,13 @@ +rust-remove-dir-all (0.5.2-1) unstable; urgency=medium + + * Package remove_dir_all 0.5.2 from crates.io using debcargo 2.2.10 + + [ Ximin Luo ] + * Package remove_dir_all 0.5.1 from crates.io using debcargo 2.2.5 + * Clean up d/copyright. + + -- Sylvestre Ledru Sun, 07 Jul 2019 10:32:42 +0200 + rust-remove-dir-all (0.5.1-1) unstable; urgency=medium * Package remove_dir_all 0.5.1 from crates.io using debcargo 2.2.1 diff -Nru rust-remove-dir-all-0.5.1/debian/control rust-remove-dir-all-0.5.2/debian/control --- rust-remove-dir-all-0.5.1/debian/control 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/control 2019-07-07 08:32:42.000000000 +0000 @@ -2,7 +2,7 @@ Section: rust Priority: optional Build-Depends: debhelper (>= 11), - dh-cargo (>= 6), + dh-cargo (>= 15), cargo:native , rustc:native , libstd-rust-dev , @@ -13,8 +13,9 @@ librust-winapi-0.3+winbase-dev , librust-winapi-0.3+winerror-dev Maintainer: Debian Rust Maintainers -Uploaders: Sylvestre Ledru -Standards-Version: 4.1.5 +Uploaders: + Sylvestre Ledru +Standards-Version: 4.2.0 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/remove-dir-all] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/remove-dir-all X-Cargo-Crate: remove_dir_all @@ -36,8 +37,8 @@ librust-remove-dir-all-0+default-dev (= ${binary:Version}), librust-remove-dir-all-0.5-dev (= ${binary:Version}), librust-remove-dir-all-0.5+default-dev (= ${binary:Version}), - librust-remove-dir-all-0.5.1-dev (= ${binary:Version}), - librust-remove-dir-all-0.5.1+default-dev (= ${binary:Version}) + librust-remove-dir-all-0.5.2-dev (= ${binary:Version}), + librust-remove-dir-all-0.5.2+default-dev (= ${binary:Version}) Description: Safe, reliable implementation of remove_dir_all for Windows - Rust source code This package contains the source for the Rust remove_dir_all crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-remove-dir-all-0.5.1/debian/copyright rust-remove-dir-all-0.5.2/debian/copyright --- rust-remove-dir-all-0.5.1/debian/copyright 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/copyright 2019-07-07 08:32:42.000000000 +0000 @@ -6,11 +6,6 @@ Files: * Copyright: 2017 Aaron Power License: MIT or Apache-2.0 -Comment: - FIXME (overlay): Since upstream copyright years are not available in - Cargo.toml, they were extracted from the upstream Git repository. This may not - be correct information so you should review and fix this before uploading to - the archive. Files: debian/* Copyright: diff -Nru rust-remove-dir-all-0.5.1/debian/copyright.debcargo.hint rust-remove-dir-all-0.5.2/debian/copyright.debcargo.hint --- rust-remove-dir-all-0.5.1/debian/copyright.debcargo.hint 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/copyright.debcargo.hint 2019-07-07 08:32:42.000000000 +0000 @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: remove_dir_all Upstream-Contact: Aaronepower -Source: https://github.com/Aaronepower/remove_dir_all.git +Source: https://github.com/XAMPPRocky/remove_dir_all.git Files: * Copyright: FIXME (overlay) UNKNOWN-YEARS Aaronepower @@ -28,8 +28,8 @@ Files: debian/* Copyright: - 2018 Debian Rust Maintainers - 2018 FIXME (overlay) Your Name + 2018-2019 Debian Rust Maintainers + 2018-2019 Sylvestre Ledru License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-remove-dir-all-0.5.1/debian/debcargo.toml rust-remove-dir-all-0.5.2/debian/debcargo.toml --- rust-remove-dir-all-0.5.1/debian/debcargo.toml 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/debcargo.toml 2019-07-07 08:32:42.000000000 +0000 @@ -1 +1,2 @@ overlay = "." +uploaders = ["Sylvestre Ledru "] diff -Nru rust-remove-dir-all-0.5.1/debian/watch rust-remove-dir-all-0.5.2/debian/watch --- rust-remove-dir-all-0.5.1/debian/watch 2018-07-29 14:35:21.000000000 +0000 +++ rust-remove-dir-all-0.5.2/debian/watch 2019-07-07 08:32:42.000000000 +0000 @@ -1,4 +1,5 @@ version=4 -opts=filenamemangle=s/.*\/(.*)\/download/remove_dir_all-$1\.tar\.gz/g\ - https://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/remove_dir_all .*/crates/remove_dir_all/@ANY_VERSION@/download +opts=filenamemangle=s/.*\/(.*)\/download/remove_dir_all-$1\.tar\.gz/g,\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \ +https://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/remove_dir_all .*/crates/remove_dir_all/@ANY_VERSION@/download diff -Nru rust-remove-dir-all-0.5.1/src/fs.rs rust-remove-dir-all-0.5.2/src/fs.rs --- rust-remove-dir-all-0.5.1/src/fs.rs 2018-04-19 14:00:14.000000000 +0000 +++ rust-remove-dir-all-0.5.2/src/fs.rs 2019-06-13 16:23:01.000000000 +0000 @@ -1,8 +1,8 @@ use std::ffi::OsString; use std::fs::{self, File, OpenOptions}; -use std::{io, ptr}; use std::os::windows::prelude::*; use std::path::{Path, PathBuf}; +use std::{io, ptr}; use winapi::shared::minwindef::*; use winapi::shared::winerror::*; @@ -24,9 +24,11 @@ /// ```rust /// extern crate remove_dir_all; /// +/// use std::fs; /// use remove_dir_all::*; /// /// fn main() { +/// fs::create_dir("./temp/").unwrap(); /// remove_dir_all("./temp/").unwrap(); /// } /// ``` @@ -77,8 +79,7 @@ let path = path.as_ref(); let mut opts = OpenOptions::new(); opts.access_mode(FILE_READ_ATTRIBUTES); - opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT); + opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT); let file = opts.open(path)?; (get_path(&file)?, path.metadata()?) }; @@ -86,8 +87,12 @@ let mut ctx = RmdirContext { base_dir: match path.parent() { Some(dir) => dir, - None => return Err(io::Error::new(io::ErrorKind::PermissionDenied, - "Can't delete root directory")) + None => { + return Err(io::Error::new( + io::ErrorKind::PermissionDenied, + "Can't delete root directory", + )) + } }, readonly: metadata.permissions().readonly(), counter: 0, @@ -101,7 +106,10 @@ remove_item(path.as_ref(), &mut ctx) } } else { - Err(io::Error::new(io::ErrorKind::PermissionDenied, "Not a directory")) + Err(io::Error::new( + io::ErrorKind::PermissionDenied, + "Not a directory", + )) } } @@ -116,9 +124,11 @@ let mut opts = OpenOptions::new(); opts.access_mode(DELETE); - opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | // delete directory + opts.custom_flags( + FILE_FLAG_BACKUP_SEMANTICS | // delete directory FILE_FLAG_OPEN_REPARSE_POINT | // delete symlink - FILE_FLAG_DELETE_ON_CLOSE); + FILE_FLAG_DELETE_ON_CLOSE, + ); let file = opts.open(path)?; move_item(&file, ctx)?; @@ -129,8 +139,8 @@ let mut perm = metadata.permissions(); perm.set_readonly(true); fs::set_permissions(&path, perm)?; - }, - Err(ref err) if err.kind() == io::ErrorKind::NotFound => {}, + } + Err(ref err) if err.kind() == io::ErrorKind::NotFound => {} err => return err.map(|_| ()), } } @@ -139,13 +149,15 @@ } fn move_item(file: &File, ctx: &mut RmdirContext) -> io::Result<()> { - let mut tmpname = ctx.base_dir.join(format!{"rm-{}", ctx.counter}); + let mut tmpname = ctx.base_dir.join(format! {"rm-{}", ctx.counter}); ctx.counter += 1; // Try to rename the file. If it already exists, just retry with an other // filename. while let Err(err) = rename(file, &tmpname, false) { - if err.kind() != io::ErrorKind::AlreadyExists { return Err(err) }; + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(err); + }; tmpname = ctx.base_dir.join(format!("rm-{}", ctx.counter)); ctx.counter += 1; } @@ -156,13 +168,14 @@ fn rename(file: &File, new: &Path, replace: bool) -> io::Result<()> { // &self must be opened with DELETE permission use std::iter; - #[cfg(target_arch = "x86")] + #[cfg(target_pointer_width = "32")] const STRUCT_SIZE: usize = 12; - #[cfg(target_arch = "x86_64")] + #[cfg(target_pointer_width = "64")] const STRUCT_SIZE: usize = 20; // FIXME: check for internal NULs in 'new' - let mut data: Vec = iter::repeat(0u16).take(STRUCT_SIZE/2) + let mut data: Vec = iter::repeat(0u16) + .take(STRUCT_SIZE / 2) .chain(new.as_os_str().encode_wide()) .collect(); data.push(0); @@ -177,10 +190,12 @@ (*info).ReplaceIfExists = if replace { -1 } else { FALSE }; (*info).RootDirectory = ptr::null_mut(); (*info).FileNameLength = (size - STRUCT_SIZE) as DWORD; - let result = SetFileInformationByHandle(file.as_raw_handle(), - FileRenameInfo, - data.as_mut_ptr() as *mut _ as *mut _, - size as DWORD); + let result = SetFileInformationByHandle( + file.as_raw_handle(), + FileRenameInfo, + data.as_mut_ptr() as *mut _ as *mut _, + size as DWORD, + ); if result == 0 { Err(io::Error::last_os_error()) @@ -191,25 +206,22 @@ } fn get_path(f: &File) -> io::Result { - - fill_utf16_buf(|buf, sz| unsafe { - GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) - }, |buf| { - PathBuf::from(OsString::from_wide(buf)) - }) + fill_utf16_buf( + |buf, sz| unsafe { GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) }, + |buf| PathBuf::from(OsString::from_wide(buf)), + ) } -fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) - -> io::Result<()> { +fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> { let dir_readonly = ctx.readonly; - for child in try!(fs::read_dir(path)) { - let child = try!(child); - let child_type = try!(child.file_type()); - ctx.readonly = try!(child.metadata()).permissions().readonly(); + for child in fs::read_dir(path)? { + let child = child?; + let child_type = child.file_type()?; + ctx.readonly = child.metadata()?.permissions().readonly(); if child_type.is_dir() { - try!(remove_dir_all_recursive(&child.path(), ctx)); + remove_dir_all_recursive(&child.path(), ctx)?; } else { - try!(remove_item(&child.path().as_ref(), ctx)); + remove_item(&child.path().as_ref(), ctx)?; } } ctx.readonly = dir_readonly; @@ -217,8 +229,9 @@ } fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result - where F1: FnMut(*mut u16, DWORD) -> DWORD, - F2: FnOnce(&[u16]) -> T +where + F1: FnMut(*mut u16, DWORD) -> DWORD, + F2: FnOnce(&[u16]) -> T, { // Start off with a stack buf but then spill over to the heap if we end up // needing more space. @@ -257,9 +270,8 @@ } else if k >= n { n = k; } else { - return Ok(f2(&buf[..k])) + return Ok(f2(&buf[..k])); } } } } - diff -Nru rust-remove-dir-all-0.5.1/src/lib.rs rust-remove-dir-all-0.5.2/src/lib.rs --- rust-remove-dir-all-0.5.1/src/lib.rs 2018-02-15 02:22:28.000000000 +0000 +++ rust-remove-dir-all-0.5.2/src/lib.rs 2019-06-13 16:23:01.000000000 +0000 @@ -1,6 +1,13 @@ #[cfg(windows)] extern crate winapi; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); + #[cfg(windows)] mod fs; @@ -9,4 +16,3 @@ #[cfg(not(windows))] pub use std::fs::remove_dir_all; -