solenv/bin/concat-deps.c |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 4415d2410cae282da8f8970c393561ec67fc5171
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Sat Dec 4 07:16:58 2021 +0100
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Mon Dec 6 11:24:06 2021 +0100

    concat-deps: ignore /./ segments in input paths
    
    concat-deps detects relative path segments (AKA /../) and
    removes these in cancel_relative(...) to save space (by removing
    the preceding path segment from the output path). But that logic
    doesn't account for preceding /./ segments, resulting in paths
    to non-existing files. This then resulted in mysterious, unneeded
    compiling of seemingly unchanged files for my incremental
    cross-toolset builds.
    
    I actually assumed some error in my complex gbuild static changes,
    which are already driving me crazy...
    
    "make -d" showed these wrong paths, but inspecting the ".d" for
    the actual files (from gcc output), they were ok; took me a while
    to realize the problem were LO's concat-dep files for libraries.
    
    But instead of complicating cancel_relative(), this just jumps
    over /./ segments in the input path. cancel_relative() works on
    the &cursor_out copy anyway.
    
    Change-Id: I2a8ecd04fdfa790859668d690a102cfb156aa649
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126345
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c
index a9e433ebe88e..fd128f6e3e4c 100644
--- a/solenv/bin/concat-deps.c
+++ b/solenv/bin/concat-deps.c
@@ -944,6 +944,14 @@ static int process(struct hash* dep_hash, char* fn)
             }
             else if(*cursor == '/')
             {
+                if(cursor + 2 < end)
+                {
+                    if(!memcmp(cursor, "/./", 3))
+                    {
+                        cursor += 2;
+                        continue;
+                    }
+                }
                 if(cursor + 3 < end)
                 {
                     if(!memcmp(cursor, "/../", 4))
@@ -1008,6 +1016,7 @@ static int process(struct hash* dep_hash, char* fn)
                 *cursor_out++ = *cursor++;
             }
         }
+
         /* just in case the file did not end with a \n, there may be a pending 
rule */
         if(base < cursor_out)
         {

Reply via email to