Skip to content

Some shell characters like '!' or '$' are not correctly escaped #62

Description

@jodeka

Tested on: Manjaro Linux

On our project we have filenames like "!$xyz.png". This is due internal requirements in the "RPG Maker MV" game engine. Normal rsync command on bash does copy them without any issues. But with gulp-rsync and these files, we have errors like the following:

gulp-rsync: rsync: [sender] link_stat "!.png" failed: No such file or directory (2)

all other files are synced without any problems. gulp then finishes with a non zero exit code and these error messages:

gulp-rsync: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1326) [sender=v3.2.4]

 Error in plugin "gulp-rsync"
Message:
    Error: rsync exited with code 23
    at ChildProcess.<anonymous> (node_modules/gulp-rsync/rsync.js:121:17)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.emit (node:domain:537:15)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)
Details:
    domainEmitter: [object Object]
    domainThrown: false

probably the escapeShellArgs function should be replaced by something like shell-escape

function escapeShellArg(arg) {
  if (!/(["'`\\\(\) ])/.test(arg)) {
    return arg;
  }
  arg = arg.replace(/([\\])/g, '/');
  return '"' + arg.replace(/(["'`\\])/g, '\\$1') + '"';
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions