Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10689

Hdfs dfs chmod should reset sticky bit permission when the bit is omitted in the octal mode

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.4
    • Fix Version/s: 3.0.0-alpha1
    • Component/s: fs
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Incompatible change
    • Release Note:
      Hide
      Hdfs dfs chmod command will reset sticky bit permission on a file/directory when the leading sticky bit is omitted in the octal mode (like 644). So when a file/directory permission is applied using octal mode and sticky bit permission needs to be preserved, then it has to be explicitly mentioned in the permission bits (like 1644). This behavior is similar to many other filesystems on Linux/BSD.
      Show
      Hdfs dfs chmod command will reset sticky bit permission on a file/directory when the leading sticky bit is omitted in the octal mode (like 644). So when a file/directory permission is applied using octal mode and sticky bit permission needs to be preserved, then it has to be explicitly mentioned in the permission bits (like 1644). This behavior is similar to many other filesystems on Linux/BSD.

      Description

      When a directory permission is modified using hdfs dfs chmod command and when octal/numeric format is used, the leading sticky bit is not fully honored.

      1. Create a dir dir_test_with_sticky_bit
      2. Apply sticky bit permission on the dir : hdfs dfs -chmod 1755 /dir_test_with_sticky_bit
      3. Remove sticky bit permission on the dir: hdfs dfs -chmod 755 /dir_test_with_sticky_bit

      Expected: Remove the sticky bit on the dir, as it happens on Mac/Linux native filesystem with native chmod.

      4. However, removing sticky bit permission by explicitly turning off the bit works. hdfs dfs -chmod 0755 /dir_test_with_sticky_bit

      manoj@~/work/hadev-pp: hdfs dfs -chmod 1755 /dir_test_with_sticky_bit
      manoj@~/work/hadev-pp: hdfs dfs -ls /
      Found 2 items
      drwxr-xr-t   - manoj supergroup          0 2016-07-25 11:42 /dir_test_with_sticky_bit
      drwxr-xr-x   - manoj supergroup          0 2016-07-25 11:42 /user
      
      manoj@~/work/hadev-pp: hdfs dfs -chmod 755 /dir_test_with_sticky_bit
      manoj@~/work/hadev-pp: hdfs dfs -ls /
      Found 2 items
      drwxr-xr-t   - manoj supergroup          0 2016-07-25 11:42 /dir_test_with_sticky_bit  <=== sticky bit still intact
      drwxr-xr-x   - manoj supergroup          0 2016-07-25 11:42 /user
      
      manoj@~/work/hadev-pp: hdfs dfs -chmod 0755 /dir_test_with_sticky_bit
      manoj@~/work/hadev-pp: hdfs dfs -ls /
      Found 2 items
      drwxr-xr-x   - manoj supergroup          0 2016-07-25 11:42 /dir_test_with_sticky_bit
      drwxr-xr-x   - manoj supergroup          0 2016-07-25 11:42 /user
      manoj@~/work/hadev-pp: 
      

        Attachments

        1. HDFS-10689.001.patch
          11 kB
          Manoj Govindassamy
        2. HDFS-10689.002.patch
          9 kB
          Manoj Govindassamy
        3. HDFS-10689.003.patch
          9 kB
          Manoj Govindassamy
        4. HDFS-10689.004.patch
          9 kB
          Manoj Govindassamy

          Activity

            People

            • Assignee:
              manojg Manoj Govindassamy
              Reporter:
              manojg Manoj Govindassamy
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: