Skip to content

Commit 38bf999

Browse files
committed
Print file permissions with 4 digits.
1 parent fca8a1d commit 38bf999

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/libstd/io/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ mod test {
12741274

12751275
error!(result, "couldn't recursively mkdir");
12761276
error!(result, "couldn't create directory");
1277-
error!(result, "mode=700");
1277+
error!(result, "mode=0700");
12781278
error!(result, format!("path={}", file.display()));
12791279
})
12801280

src/libstd/io/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ impl Default for FilePermission {
18381838
impl fmt::Show for FilePermission {
18391839
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
18401840
formatter.fill = '0';
1841-
formatter.width = Some(3);
1841+
formatter.width = Some(4);
18421842
(&self.bits as &fmt::Octal).fmt(formatter)
18431843
}
18441844
}
@@ -1949,13 +1949,13 @@ mod tests {
19491949
fn test_show() {
19501950
use super::*;
19511951

1952-
assert_eq!(format!("{}", UserRead), "400".to_string());
1953-
assert_eq!(format!("{}", UserFile), "644".to_string());
1954-
assert_eq!(format!("{}", UserExec), "755".to_string());
1955-
assert_eq!(format!("{}", UserRWX), "700".to_string());
1956-
assert_eq!(format!("{}", GroupRWX), "070".to_string());
1957-
assert_eq!(format!("{}", OtherRWX), "007".to_string());
1958-
assert_eq!(format!("{}", AllPermissions), "777".to_string());
1959-
assert_eq!(format!("{}", UserRead | UserWrite | OtherWrite), "602".to_string());
1952+
assert_eq!(format!("{}", UserRead), "0400".to_string());
1953+
assert_eq!(format!("{}", UserFile), "0644".to_string());
1954+
assert_eq!(format!("{}", UserExec), "0755".to_string());
1955+
assert_eq!(format!("{}", UserRWX), "0700".to_string());
1956+
assert_eq!(format!("{}", GroupRWX), "0070".to_string());
1957+
assert_eq!(format!("{}", OtherRWX), "0007".to_string());
1958+
assert_eq!(format!("{}", AllPermissions), "0777".to_string());
1959+
assert_eq!(format!("{}", UserRead | UserWrite | OtherWrite), "0602".to_string());
19601960
}
19611961
}

0 commit comments

Comments
 (0)