Skip to content

Paths which include special characters in the name cause an exception #29

@xrouge

Description

@xrouge

Similar to: #3

Python 3.12
For example, @ in the path:

Traceback (most recent call last):
  File "D:\dev\my\p4transfer\P4Transfer.py", line 2664, in replicate
    num_changes = self.replicate_changes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\my\p4transfer\P4Transfer.py", line 2478, in replicate_changes
    targetChange = self.target.replicateChange(fileRevs, specialMoveRevs, srcFileLogs, change, self.source.p4.port)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\my\p4transfer\P4Transfer.py", line 1585, in replicateChange
    self.processChangeRevs(fileRevs, specialMoveRevs, srcFileLogs)
  File "D:\dev\my\p4transfer\P4Transfer.py", line 1514, in processChangeRevs
    self.replicateBranch(f, dirty=False)
  File "D:\dev\my\p4transfer\P4Transfer.py", line 1901, in replicateBranch
    self.p4cmd('sync', '-k', file.fixedLocalFile)
  File "D:\dev\my\p4transfer\P4Transfer.py", line 1044, in p4cmd
    output = self.p4.run(args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\dev\my\p4transfer\.venv\Lib\site-packages\P4.py", line 624, in run
    raise e
  File "D:\dev\my\p4transfer\.venv\Lib\site-packages\P4.py", line 618, in run
    result = P4API.P4Adapter.run(self, *flatArgs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
P4.P4Exception: [P4#run] Errors during command execution( "p4 sync -k D:\dev\p4transfer\nodejs\6.11.0-win-x64\node_modules\npm\node_modules\node-gyp\node_modules\path-array\node_modules\array-index\node_modules\es6-symbol\node_modules\es5-ext\array\#\@@iterator\implement.js" )

        [Error]: "Invalid revision number '\\@@iterator\\implement.js'."

`2024-07-07 09:03:57,755:P4Transfer:DEBUG: processing:0230 add`

escapeWildCards() should handle this, but maybe it's not called from this code path. I understand that the special characters are allowed only when adding files, but ASCII expansion should be used in all other commands
https://www.perforce.com/manuals/v22.2/p4guide/Content/P4Guide/syntax.syntax.restrictions.html

therefore fixedLocalFile shouldn't be used here because setLocalFile has the opposite intent:

self.p4cmd('sync', '-k', file.fixedLocalFile)

maybe file.localFile instead of file.fixedLocalFile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions