Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16918

XAR export with history fails when the OS user account name contains a dollar sign

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.11.10
    • Fix Version/s: 11.10.2, 12.0-rc-1
    • Component/s: Old Core
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      To reproduce:

      • Start the Servlet Container JVM with
        -Duser.name="vincent$"
      • Create a wiki page and attach a file to it
      • In the Admin UI, export this page with history/backup
      • Try to reimport it with history

      You'll get:

      Caused by: org.suigeneris.jrcs.rcs.parse.TokenMgrError: Lexical error at line 1, column 101.  Encountered: "$" (36), after : ""
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParserTokenManager.getNextToken(ArchiveParserTokenManager.java:817)
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParser.jj_ntk(ArchiveParser.java:685)
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParser.authorName(ArchiveParser.java:527)
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParser.delta(ArchiveParser.java:385)
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParser.archive(ArchiveParser.java:96)
      	at org.suigeneris.jrcs.rcs.parse.ArchiveParser.load(ArchiveParser.java:60)
      	at org.suigeneris.jrcs.rcs.Archive.<init>(Archive.java:259)
      	at com.xpn.xwiki.doc.XWikiAttachmentArchive.setArchive(XWikiAttachmentArchive.java:213)
      	at com.xpn.xwiki.doc.XWikiAttachment.setArchive(XWikiAttachment.java:967)
      ...
      

      The reason is:

      • JRCS uses
        String author = System.getProperty("user.name");

        as the default author name when not set. See Node.java

      • JRCS doesn't escape it. See line 647 in Node.java (method toString())

        Attachments

          Activity

            People

            • Assignee:
              vmassol Vincent Massol
              Reporter:
              vmassol Vincent Massol
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: