commit | 5faef51562ce896bcb973dc321009808712e1659 | [log] [tgz] |
---|---|---|
author | Ian Maxon <ian@maxons.email> | Mon Jan 25 20:37:18 2021 -0800 |
committer | Ian Maxon <imaxon@uci.edu> | Tue Feb 09 16:51:13 2021 +0000 |
tree | 59531852de86638e78cfafdcf3ac423a1c0ee4b9 | |
parent | 7707f1f02f59293e1aa3a899846cd54c676d02a8 [diff] |
[ASTERIXDB-2819][IO] Make absolute & normalize IODevice paths This improves the issue of not canonicalizing IOManager paths by at least making them absolute and removing redundant ./ and ../ parts of the path. Change-Id: Ib71fd775eb8e4b1df548350152a7331316abd5b5 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9444 Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java index a2d28e1..c826c2f 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IODeviceHandle.java
@@ -20,6 +20,7 @@ import java.io.File; import java.io.Serializable; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -80,7 +81,7 @@ public static List<IODeviceHandle> getDevices(String[] ioDevices) { List<IODeviceHandle> devices = new ArrayList<>(); for (String ioDevice : ioDevices) { - String devPath = ioDevice.trim(); + String devPath = Paths.get(ioDevice.trim()).toAbsolutePath().normalize().toString(); devices.add(new IODeviceHandle(new File(devPath), ".")); } return devices;
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java index da78a0d..dee61a4 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java
@@ -414,9 +414,9 @@ } public IODeviceHandle getDevice(String fullPath) { - Path full = Paths.get(fullPath); + Path full = Paths.get(fullPath).normalize(); for (IODeviceHandle d : ioDevices) { - if (full.startsWith(Paths.get(d.getMount().getAbsolutePath()))) { + if (full.startsWith(Paths.get(d.getMount().getAbsolutePath()).normalize())) { return d; } }