sadanand48 opened a new pull request, #5239:
URL: https://github.com/apache/ozone/pull/5239

   ## What changes were proposed in this pull request?
   In case of deleting the  root, In `o3fs`, the path would be pointing to a 
bucket, If it is not a fully qualified path, it would just be relative to the 
root and the path would be = "/"
   path ="/"; 
   NPE is obtained while doing path.getParent() as "/" parent will be null. 
   ```java 
   String qpath = this.fs.makeQualified(path).toString();
   Path trashRoot = this.fs.getTrashRoot(path);
   Path trashCurrent = new Path(trashRoot, CURRENT);
   Path trashPath = this.makeTrashRelativePath(trashCurrent, path);
   Path baseTrashPath = this.makeTrashRelativePath(trashCurrent, 
path.getParent());
   
   ```
   The fix here would be  would be to make getTrashRoot() return a qualified 
path which even is the same behaviour in HDFS. If that is fixed we would get a 
proper warning while deleting the root as the below condition will pass
   
   ```java 
   else if (trashRoot.getParent().toString().startsWith(qpath)) {
           throw new IOException("Cannot move \"" + path + "\" to the trash, as 
it contains the trash");
         } 
   ```
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-4838
   
   ## How was this patch tested?
   Unit tests
   


-- 
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