Skip to content

Commit

Permalink
WX-1015 Override glob behavior for TES to use absolute path (#7120)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraefrei authored Apr 18, 2023
1 parent 037f1d0 commit b568fac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait GlobFunctions extends IoFunctionSet with AsyncIoFunctions {
import GlobFunctions._
val globPatternName = globName(pattern)
val listFilePath = callContext.root.resolve(s"${globName(pattern)}.list")
asyncIo.readLinesAsync(listFilePath.toRealPath()) map { lines =>
asyncIo.readLinesAsync(listFilePath.getSymlinkSafePath()) map { lines =>
lines.toList map { fileName =>
(callContext.root / globPatternName / fileName).pathAsString
}
Expand Down
8 changes: 7 additions & 1 deletion core/src/main/scala/cromwell/core/path/NioPathMethods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cromwell.core.path

import java.nio.file.WatchEvent.{Kind, Modifier}
import java.nio.file.{LinkOption, WatchKey, WatchService}

import scala.jdk.CollectionConverters._

/**
Expand Down Expand Up @@ -68,4 +67,11 @@ trait NioPathMethods {
final def startsWith(other: String): Boolean = nioPathPrivate.startsWith(other)

final def toRealPath(options: LinkOption*): Path = newPath(nioPathPrivate.toRealPath(options: _*))

/**
* Get a valid path object that resolves symlinks if supported
* Default implementation assumes symlinks are supported, and that toRealPath may return a valid path.
* This implementation may be overridden for NIO implementations that do not support symbolic links (For example the Azure NIO library)
*/
def getSymlinkSafePath(options: LinkOption*): Path = toRealPath(options: _*)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package cromwell.filesystems.blob

import com.azure.storage.blob.nio.{AzureBlobFileAttributes}
import com.azure.storage.blob.nio.AzureBlobFileAttributes
import com.google.common.net.UrlEscapers
import cromwell.core.path.{NioPath, Path, PathBuilder}
import cromwell.filesystems.blob.BlobPathBuilder._

import java.net.{MalformedURLException, URI}
import java.nio.file.{Files, LinkOption}
import scala.language.postfixOps
import scala.util.{Failure, Success, Try}
import java.nio.file.Files

object BlobPathBuilder {

Expand Down Expand Up @@ -119,4 +119,6 @@ case class BlobPath private[blob](pathString: String, endpoint: EndpointURL, con
}
)
}

override def getSymlinkSafePath(options: LinkOption*): Path = toAbsolutePath
}

0 comments on commit b568fac

Please sign in to comment.