typedb/typedb-driver-examples

Relative file paths not resolved correctly

Closed this issue · 1 comments

Description

Attempting to load a schema through grakn console using a file flag and relative path (e.g. -f ./path/to/schema/schema.gql) on OS X fails. Using absolute paths succeeds.

Environment

  1. OS (where Grakn server runs): OS X 10.
  2. Grakn version (and platform): { e.g. Grakn Core 1.4, or Grakn KGMS 1.4.3 on Google Cloud }
  3. Grakn client: console
  4. Other environment details: N/A

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Clean install of grakn using installation instructions for brew.
  2. grakn console version = 1.0.0, grakn server version = 1.5.7
  3. Clone the examples: git clone git@github.com:graknlabs/examples.git
  4. Attempt to load the phone calls schema:
cd examples
grakn console -k phone_calls -f ./schemas/phone-calls-schema.gql

This fails with a NoSuchFileException. However, specifying the full path succeeds.

Expected Output

grakn console  -k phone_calls -f /Users/XXX/YYY/examples/schemas/phone-calls-schema.gql

gives

Loading: /Users/XXX/YYY/examples/schemas/phone-calls-schema.gql
...
{}
Successful commit: phone-calls-schema.gql

Actual Output

grakn console   -k phone_calls -f ./schemas/phone-calls-schema.gql

gives

...
java.nio.file.NoSuchFileException: ./schemas/phone-calls-schema.gql
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.Files.newByteChannel(Files.java:361)
	at java.nio.file.Files.newByteChannel(Files.java:407)
	at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
	at java.nio.file.Files.newInputStream(Files.java:152)
	at java.nio.file.Files.newBufferedReader(Files.java:2784)
	at java.nio.file.Files.readAllLines(Files.java:3202)
	at grakn.core.console.ConsoleSession.readFile(ConsoleSession.java:166)
	at grakn.core.console.ConsoleSession.load(ConsoleSession.java:109)
	at grakn.core.console.GraknConsole.run(GraknConsole.java:104)
	at grakn.core.console.GraknConsole.main(GraknConsole.java:140)

Additional information

I haven't tested this on any other set up or OS.

Damn it, apologies, I meant to open this issue in grakn core, and I see there are similar issues over there; I'll close it off here.