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

Recursively deleting file protected by sticky bit should fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.6.0
    • 3.0.0-alpha4
    • fs
    • Incompatible change, Reviewed
    • Changed the behavior of removing directories with sticky bits, so that it is closer to what most Unix/Linux users would expect.

    Description

      Recursively deleting a directory that contains files or directories protected by sticky bit should fail but it doesn't in HDFS. In the case below, /tmp/test/sticky_dir/f2 is protected by sticky bit, thus recursive deleting /tmp/test/sticky_dir should fail.

      + hdfs dfs -ls -R /tmp/test
      drwxrwxrwt   - jzhuge supergroup          0 2016-11-03 18:08 /tmp/test/sticky_dir
      -rwxrwxrwx   1 jzhuge supergroup          0 2016-11-03 18:08 /tmp/test/sticky_dir/f2
      
      + sudo -u hadoop hdfs dfs -rm -skipTrash /tmp/test/sticky_dir/f2
      rm: Permission denied by sticky bit: user=hadoop, path="/tmp/test/sticky_dir/f2":jzhuge:supergroup:-rwxrwxrwx, parent="/tmp/test/sticky_dir":jzhuge:supergroup:drwxrwxrwt
      
      + sudo -u hadoop hdfs dfs -rm -r -skipTrash /tmp/test/sticky_dir
      Deleted /tmp/test/sticky_dir
      

      Centos 6.4 behavior:

      $ ls -lR /tmp/test
      /tmp/test: 
      total 4
      drwxrwxrwt 2 systest systest 4096 Nov  3 18:36 sbit
      
      /tmp/test/sbit:
      total 0
      -rw-rw-rw- 1 systest systest 0 Nov  2 13:45 f2
      
      $ sudo -u mapred rm -fr /tmp/test/sbit
      rm: cannot remove `/tmp/test/sbit/f2': Operation not permitted
      
      $ chmod -t /tmp/test/sbit
      $ sudo -u mapred rm -fr /tmp/test/sbit
      

      Attachments

        1. hdfs_cmds
          1 kB
          John Zhuge
        2. HDFS-11100.001.patch
          7 kB
          John Zhuge
        3. HDFS-11100.002.patch
          7 kB
          John Zhuge
        4. HDFS-11100.003.patch
          7 kB
          John Zhuge
        5. HDFS-11100.004.patch
          10 kB
          John Zhuge
        6. HDFS-11100.005.patch
          10 kB
          John Zhuge

        Activity

          People

            jzhuge John Zhuge
            jzhuge John Zhuge
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: