Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1874

When I use mongodump export data, reported "Failed:" rrkd_activity.coupon_receive_ Alipay welcome "contains a path separator 'branch and can not be dumped to the filesystem

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.10
    • Component/s: mongodump
    • Labels:
      None

      In my database, some of the table is named in Chinese, when I use mongodump export these tables, mongodump reported "Failed: "rrkd_activity.coupon_receive_支付宝迎新" contains a path separator '支' and can't be dumped to the filesystem.

      After my analysis, this error occurred in the checkStringForPathSeparator () function of mongodump.

      func checkStringForPathSeparator(s string, c *rune) bool {
               for _, *c = range s {
                         if os.IsPathSeparator(uint8(*c)) {
                                  return true
                         }
               }
               return false
      }
      
      

      In this function, we call IsPathSeparator () function to determine if the character contains the path separator, but if c is a Chinese, such as "支", his unicode is encoded as \u652f, If only intercepted 8 bits, it coincides with the code of "/", so the "支" is misjudged as the path separator.

      The following is the test program:

      func main() {
               var c rune
               c = '支'
               println(c)
               println(uint8(c))
               c = '/'
               println(c)
      }
      

      The result is:
      25903
      47
      47

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            sleier lake
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: