summaryrefslogtreecommitdiff
path: root/src/Depfile.hpp
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2020-11-19 21:31:41 +0100
committerJoel Rosdahl <joel@rosdahl.net>2020-11-19 21:39:32 +0100
commitf06b2beeeea442e5533ae9936be8d2e038bc3bdd (patch)
tree35880fc60500e95fe803d37e154ebfb466f7d591 /src/Depfile.hpp
parentef5fde60c0b817680df3b4df3d9e3239117b0e14 (diff)
downloadccache-f06b2beeeea442e5533ae9936be8d2e038bc3bdd.tar.gz
Fix bug in depfile when output filename includes special characters
The rewriting of the dependency file content introduced in 2ab31632 just replaces the object file part of the dependency file with the raw filename. This is incorrect if the filename includes special characters such as space or dollar. Fix this by escaping the filename properly. Note that newlines are not treated specially since Make cannot handle them anyway. See also the similar bug fix for the depend mode (but for parsing instead of escaping in that case) in 1d2b5bf4.
Diffstat (limited to 'src/Depfile.hpp')
-rw-r--r--src/Depfile.hpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/Depfile.hpp b/src/Depfile.hpp
index a6a67e50..770f7896 100644
--- a/src/Depfile.hpp
+++ b/src/Depfile.hpp
@@ -29,6 +29,7 @@ class Hash;
namespace Depfile {
+std::string escape_filename(nonstd::string_view filename);
nonstd::optional<std::string> rewrite_paths(const Context& ctx,
const std::string& file_content);
void make_paths_relative_in_output_dep(const Context& ctx);