fetchpatch: escape excludes and includes

Excludes and includes are implemented by passing the parameters to the
respective flags of `filterdiff`. Those were passed unescaped until now.
Since those flags expect patterns (similar to shell globs), something
like `/some/path/*` might be used to exclude or include all files in
some path. Without escaping the shell would expand the `*`, leading to
unexpected behaviour.
This commit is contained in:
Timo Kaufmann 2018-07-15 09:58:47 +02:00
parent aa6adfc324
commit 1ddab0efb1

View File

@ -23,8 +23,8 @@ fetchurl ({
--clean "$out" > "$tmpfile" --clean "$out" > "$tmpfile"
${patchutils}/bin/filterdiff \ ${patchutils}/bin/filterdiff \
-p1 \ -p1 \
${builtins.toString (builtins.map (x: "-x ${x}") excludes)} \ ${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \
${builtins.toString (builtins.map (x: "-i ${x}") includes)} \ ${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \
"$tmpfile" > "$out" "$tmpfile" > "$out"
${args.postFetch or ""} ${args.postFetch or ""}
''; '';