[ 
https://issues.apache.org/jira/browse/TINKERPOP-2683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470557#comment-17470557
 ] 

Stephen Mallette commented on TINKERPOP-2683:
---------------------------------------------

This is an interesting question. My initial thought is that the grammar is 
meant to be the canonical Gremlin representation, so the question is: what is 
the file path specification in Gremlin? It would then be up to the underlying 
implementation to interpret that and properly translate the file path to one 
understood by the OS it is executing on. 

So, I think that the fix here would be to update the parser, specifically 
{{TraversalSourceSpawnMethodVisitor}} which would take the grammar 
representation of a path and convert it to be OS specific. Perhaps we should 
even have the notion of a {{File}} in the grammar itself to make this all more 
explicit?

> Defective Path in Testing g.io()
> --------------------------------
>
>                 Key: TINKERPOP-2683
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2683
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: tinkergraph
>    Affects Versions: 3.5.1
>            Reporter: Fredrick Eisele
>            Priority: Blocker
>              Labels: easyfix, test-stability
>
> I found a small bug in the tinkergraph testing on windows 10. 
> It comes up because the grammar does not allow a '\' ...
> {code:none}
> fragment
> DoubleQuotedStringCharacters
>     :    DoubleQuotedStringCharacter+
>     ;
> fragment
> DoubleQuotedStringCharacter
>     :    ~('"' | '\\')
>     |   JoinLineEscape
>     |    EscapeSequence
>     ;
> {code}
> ```
> ...and the function which locates the g.io() file adds in a '\'.
> [TinkerGraphWorld.java|https://github.com/apache/tinkerpop/blob/53503bfa28ba1de061204fb96835dee856576bbf/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphWorld.java]
> {code:java}
>     @Override
>     public String changePathToDataFile(final String pathToFileFromGremlin) {
>          return ".." + File.separator + pathToFileFromGremlin;
>     }
> {code}
> The File.separator on linux is a valid character '/' but the problematic '\' 
> character on Windows 10. 
> Which gets called by...
> [StepDefinition.java|https://github.com/apache/tinkerpop/blob/53503bfa28ba1de061204fb96835dee856576bbf/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/features/StepDefinition.java]
> {code:java}
>     private String tryUpdateDataFilePath(final String docString) {
>         final Matcher matcher = ioPattern.matcher(docString);
>         final String gremlin = matcher.matches() ?
>                 docString.replace(matcher.group(1), 
> world.changePathToDataFile(matcher.group(1))) : docString;
>         return gremlin;
>     }
> {code}
> In particular this gets triggered by the 
> [Read.feature|https://github.com/apache/tinkerpop/blob/53503bfa28ba1de061204fb96835dee856576bbf/gremlin-test/features/sideEffect/Read.feature]
>  .



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to