HADOOP-19290. Operating on / in ChecksumFileSystem throws NPE. (#7074). Contributed by Ayush Saxena.

This commit is contained in:
Ayush Saxena 2024-09-28 19:35:32 +05:30 committed by GitHub
parent 01401d71ef
commit 3fda243419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -770,7 +770,7 @@ public FSDataOutputStream createNonRecursive(final Path f,
abstract class FsOperation {
boolean run(Path p) throws IOException {
boolean status = apply(p);
if (status) {
if (status && !p.isRoot()) {
Path checkFile = getChecksumFile(p);
if (fs.exists(checkFile)) {
apply(checkFile);

View File

@ -300,4 +300,11 @@ public void testSetPermissionCrc() throws Exception {
assertEquals(perm, rawFs.getFileStatus(crc).getPermission());
}
}
@Test
public void testOperationOnRoot() throws Exception {
Path p = new Path("/");
localFs.mkdirs(p);
localFs.setReplication(p, localFs.getFileStatus(p).getPermission().toShort());
}
}