node -v: v8.6.0npm -v: 5.5.1snyk -v: 1.42.6uname -rs: FreeBSD 10.3-STABLEpatch -v: patch 2.0-12u10 FreeBSDgpatch -v | head -1: GNU patch 2.7.5 (after pkg install patch)snyk wizardPatches apply successfully after answering wizard's prompts.
Patches fail to apply, --debug reveals the following sort of errors:
snyk patch command failed [foo] { Error: Command failed: patch -p1 --backup --verbose < /tmp/[foo].snyk-patch --dry-run
patch: unrecognized option `--verbose'
usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]
[-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]
[-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext]
[--posix] [origfile [patchfile]]
patch <patchfile
at ChildProcess.exithandler (child_process.js:271:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Socket.stream.socket.on (internal/child_process.js:348:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:547:12)
killed: false,
code: 1,
signal: null,
cmd: 'patch -p1 --backup --verbose < /tmp/[foo].snyk-patch --dry-run' } +15ms
--
Obviously I can work around this by just installing GNU patch and symlinking it to the name snyk expects, but that was not immediately obvious as a requirement of this project in any of the documentation I read. Assuming the output produced by --verbose is needed, should GNU patch be mentioned as a requirement somewhere or even tested for at runtime?
A similar thing happens with alpine linux (which is used in a lot of docker images). It uses busybox and the patch command it has available does not have the --backup option. Similar to you, the workaround is to install GNU patch.
currently snyk outputs Snyk couldn't patch the specified vulnerabilities because GNU's patch is not available. Please install 'patch' and try again. when patch could not be found, especially in Windows environment.
I agree with @welwood08, I suggest the error message to be displayed as well when patch is not the GNU version, even when --debug is not enabled.
:wave: This issue has not had a lot of activity for a while, we are closing. Please re-open if there is anything else further.
Most helpful comment
A similar thing happens with alpine linux (which is used in a lot of docker images). It uses busybox and the patch command it has available does not have the
--backupoption. Similar to you, the workaround is to install GNU patch.