aryangupta1998 commented on code in PR #12193:
URL: https://github.com/apache/ozone/pull/12193#discussion_r4775646792
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/OzoneFileSystemTestBase.java:
##########
@@ -432,6 +434,34 @@ void setVerifyChecksum(MiniOzoneCluster cluster, Path
path) throws Exception {
}
}
+ /**
+ * Files are reported with {@code ozone.fs.file.permission.reported}, by
both getFileStatus and listStatus, and
+ * directories with 777. Deletes the test directory.
+ */
+ void reportedFilePermission(Path root) throws IOException {
+ Path dir = new Path(root, "testReportedFilePermission");
+ Path file = new Path(dir, "file");
+ FileSystem fs = getFs();
+ fs.mkdirs(dir);
+ ContractTestUtils.touch(fs, file);
+ try {
+ assertEquals(FsPermission.getFileDefault(),
fs.getFileStatus(file).getPermission());
+
+ OzoneConfiguration conf = new OzoneConfiguration(fs.getConf());
+ conf.set(OZONE_FS_FILE_PERMISSION_REPORTED, "600");
+ FsPermission ownerOnly = new FsPermission((short) 0600);
+ try (FileSystem ownerOnlyFs = FileSystem.newInstance(fs.getUri(), conf))
{
+ assertEquals(ownerOnly,
ownerOnlyFs.getFileStatus(file).getPermission());
+ FileStatus[] listing = ownerOnlyFs.listStatus(dir);
Review Comment:
Good point: the listing had only a file, and the directory check used
getFileStatus, so the lite path was never checked for directories. Added a
subdirectory to the listing. With your change, both TestO3FS and TestOFS now
fail on subdir (expected rwxrwxrwx, was rw-------).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]