Merge -r 1331492:1331493 from trunk to branch. FIXES: HDFS-3309
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1331494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0581c7e598
commit
596831bcba
|
@ -43,8 +43,8 @@ import java.util.Map;
|
||||||
public class FSOperations {
|
public class FSOperations {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Unix permission octal & symbolic representation
|
* Converts a Unix permission octal
|
||||||
* (i.e. 655 or -rwxr--r--) into a FileSystemAccess permission.
|
* (i.e. 655 or 1777) into a FileSystemAccess permission.
|
||||||
*
|
*
|
||||||
* @param str Unix permission symbolic representation.
|
* @param str Unix permission symbolic representation.
|
||||||
*
|
*
|
||||||
|
@ -55,10 +55,8 @@ public class FSOperations {
|
||||||
FsPermission permission;
|
FsPermission permission;
|
||||||
if (str.equals(HttpFSFileSystem.DEFAULT_PERMISSION)) {
|
if (str.equals(HttpFSFileSystem.DEFAULT_PERMISSION)) {
|
||||||
permission = FsPermission.getDefault();
|
permission = FsPermission.getDefault();
|
||||||
} else if (str.length() == 3) {
|
|
||||||
permission = new FsPermission(Short.parseShort(str, 8));
|
|
||||||
} else {
|
} else {
|
||||||
permission = FsPermission.valueOf(str);
|
permission = new FsPermission(Short.parseShort(str, 8));
|
||||||
}
|
}
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ public class HttpFSParams {
|
||||||
* Symbolic Unix permissions regular expression pattern.
|
* Symbolic Unix permissions regular expression pattern.
|
||||||
*/
|
*/
|
||||||
private static final Pattern PERMISSION_PATTERN =
|
private static final Pattern PERMISSION_PATTERN =
|
||||||
Pattern.compile(DEFAULT + "|(-[-r][-w][-x][-r][-w][-x][-r][-w][-x])" + "|[0-7][0-7][0-7]");
|
Pattern.compile(DEFAULT + "|[0-1]?[0-7][0-7][0-7]");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
@ -310,11 +310,8 @@ public class TestHttpFSFileSystem extends HFSTestCase {
|
||||||
|
|
||||||
private void testSetPermission() throws Exception {
|
private void testSetPermission() throws Exception {
|
||||||
FileSystem fs = FileSystem.get(TestHdfsHelper.getHdfsConf());
|
FileSystem fs = FileSystem.get(TestHdfsHelper.getHdfsConf());
|
||||||
Path path = new Path(TestHdfsHelper.getHdfsTestDir(), "foo.txt");
|
Path path = new Path(TestHdfsHelper.getHdfsTestDir(), "foodir");
|
||||||
OutputStream os = fs.create(path);
|
fs.mkdirs(path);
|
||||||
os.write(1);
|
|
||||||
os.close();
|
|
||||||
fs.close();
|
|
||||||
|
|
||||||
fs = getHttpFileSystem();
|
fs = getHttpFileSystem();
|
||||||
FsPermission permission1 = new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE);
|
FsPermission permission1 = new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE);
|
||||||
|
@ -326,6 +323,19 @@ public class TestHttpFSFileSystem extends HFSTestCase {
|
||||||
fs.close();
|
fs.close();
|
||||||
FsPermission permission2 = status1.getPermission();
|
FsPermission permission2 = status1.getPermission();
|
||||||
Assert.assertEquals(permission2, permission1);
|
Assert.assertEquals(permission2, permission1);
|
||||||
|
|
||||||
|
//sticky bit
|
||||||
|
fs = getHttpFileSystem();
|
||||||
|
permission1 = new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE, true);
|
||||||
|
fs.setPermission(path, permission1);
|
||||||
|
fs.close();
|
||||||
|
|
||||||
|
fs = FileSystem.get(TestHdfsHelper.getHdfsConf());
|
||||||
|
status1 = fs.getFileStatus(path);
|
||||||
|
fs.close();
|
||||||
|
permission2 = status1.getPermission();
|
||||||
|
Assert.assertTrue(permission2.getStickyBit());
|
||||||
|
Assert.assertEquals(permission2, permission1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSetOwner() throws Exception {
|
private void testSetOwner() throws Exception {
|
||||||
|
|
|
@ -445,6 +445,9 @@ Release 2.0.0 - UNRELEASED
|
||||||
|
|
||||||
HDFS-3181. Fix a test case in TestLeaseRecovery2. (szetszwo)
|
HDFS-3181. Fix a test case in TestLeaseRecovery2. (szetszwo)
|
||||||
|
|
||||||
|
HDFS-3309. HttpFS (Hoop) chmod not supporting octal and sticky bit
|
||||||
|
permissions. (tucu)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-1623 SUBTASKS
|
BREAKDOWN OF HDFS-1623 SUBTASKS
|
||||||
|
|
||||||
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
||||||
|
|
Loading…
Reference in New Issue