neils-dev commented on code in PR #4246:
URL: https://github.com/apache/ozone/pull/4246#discussion_r1167151031


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -659,22 +659,27 @@ public boolean delete(Path f, boolean recursive) throws 
IOException {
         }
       }
 
+      // handling posix symlink delete behaviours
+      // i.) rm [-r] <symlink path>, delete symlink not target bucket contents
+      // ii.) rm -r <symlink path>/, delete target bucket contents not symlink
+      boolean handleTrailingSlash = false;
       boolean isBucketLink = false;
       // check for bucket link
       if (ofsPath.isBucket()) {
         isBucketLink = adapterImpl.getBucket(ofsPath, false)
             .isLink();
+        handleTrailingSlash = f.toString().endsWith(OZONE_URI_DELIMITER);
       }
 
       // if link, don't delete contents
-      if (isBucketLink) {
+      if (isBucketLink && !handleTrailingSlash) {
         result = true;
       } else {
         result = innerDelete(f, recursive);
       }
 
       // Handle delete bucket
-      if (ofsPath.isBucket()) {
+      if (ofsPath.isBucket() && !handleTrailingSlash) {

Review Comment:
   comment updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to