Yiqun Zhang created ORC-1035:
--------------------------------

             Summary: `backupDataPath` may be incorrect in recoverFile
                 Key: ORC-1035
                 URL: https://issues.apache.org/jira/browse/ORC-1035
             Project: ORC
          Issue Type: Bug
          Components: Java, tools
    Affects Versions: 1.6.11, 1.7.0, 1.8.0
            Reporter: Yiqun Zhang


{code:java}
      public static final String DEFAULT_BACKUP_PATH = 
System.getProperty("java.io.tmpdir");
      ......
      String scheme = corruptPath.toUri().getScheme();
      String authority = corruptPath.toUri().getAuthority();
      String filePath = corruptPath.toUri().getPath();
      if (backup.equals(DEFAULT_BACKUP_PATH)) {
        backupDataPath = new Path(scheme, authority, DEFAULT_BACKUP_PATH + 
filePath);
      } else {
        backupDataPath = Path.mergePaths(new Path(backup), corruptPath);
      }
{code}
1.  System.getProperty("java.io.tmpdir") gets a path that may or may not end in 
Path.SEPARATOR, as seen in the [Travis 
ci|https://app.travis-ci.com/github/apache/orc/jobs/544381649#L1580] example, 
the path generated directly by DEFAULT_BACKUP_PATH + filePath may not be 
correct.

 

2. corruptPath is the path entered by the user, which may be absolute or 
relative. The second argument of Path.mergePaths is expected to be a path 
starting with Path.SEPARATOR, so when the user enters a relative path, 
Path.mergePaths(new Path(backup), corruptPath) the result is also incorrect.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to