hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject git commit: HDFS-7162. Wrong path when deleting through fuse-dfs a file which already exists in trash (cmccabe) (cherry picked from commit 03db9cc839663cad387db7df8e4f60b312058f18)
Date Thu, 02 Oct 2014 19:42:53 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 531c1fd00 -> ab1afc4e1


HDFS-7162. Wrong path when deleting through fuse-dfs a file which already exists in trash
(cmccabe)
(cherry picked from commit 03db9cc839663cad387db7df8e4f60b312058f18)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ab1afc4e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ab1afc4e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ab1afc4e

Branch: refs/heads/branch-2
Commit: ab1afc4e1cafc1cd81cca36eccc1c905afb7293b
Parents: 531c1fd
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Thu Oct 2 12:42:19 2014 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Thu Oct 2 12:42:47 2014 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                   | 3 +++
 .../hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c         | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab1afc4e/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 13b183e..8538e43 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -545,6 +545,9 @@ Release 2.6.0 - UNRELEASED
     HDFS-7178. Additional unit test for replica write with full disk.
     (Arpit Agarwal)
 
+    HDFS-7162. Wrong path when deleting through fuse-dfs a file which already
+    exists in trash (cmccabe)
+
     BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
   
       HDFS-6387. HDFS CLI admin tool for creating & deleting an

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab1afc4e/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c
index 688eae8..5e58087 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_trash.c
@@ -150,13 +150,14 @@ int move_to_trash(const char *abs_path, hdfsFS userFS)
   if (ret) {
     goto done;
   }
-  if (!strncmp(trash_base, abs_path, strlen(trash_base))) {
+  int trash_base_len = strlen(trash_base);
+  if (!strncmp(trash_base, abs_path, trash_base_len)
+      && (strlen(abs_path) == trash_base_len || abs_path[trash_base_len] == '/'))
{
     INFO("move_to_trash(%s): file is already in the trash; deleting.",
          abs_path);
     ret = ALREADY_IN_TRASH_ERR;
     goto done;
   }
-  fprintf(stderr, "trash_base='%s'\n", trash_base);
   if (asprintf(&target_dir, "%s%s", trash_base, parent_dir) < 0) {
     ret = ENOMEM;
     target_dir = NULL;
@@ -182,7 +183,7 @@ int move_to_trash(const char *abs_path, hdfsFS userFS)
     int idx;
     for (idx = 1; idx < TRASH_RENAME_TRIES; idx++) {
       free(target);
-      if (asprintf(&target, "%s%s.%d", target_dir, pcomp, idx) < 0) {
+      if (asprintf(&target, "%s/%s.%d", target_dir, pcomp, idx) < 0) {
         target = NULL;
         ret = ENOMEM;
         goto done;


Mime
View raw message