On Monday, February 19, 2018 at 1:24:46 AM UTC+1, [email protected] wrote:
>
> Hi Kristoffer, 
>
> On Sun, Feb 18, 2018 at 4:08 AM, Kristoffer Koch <[email protected] 
> <javascript:>> wrote: 
>
> > I can't share the project, and it doesn't seem trivial to create a 
> > test-case, but I would very much like to help solve this :) 
>
> Thanks for the detailed backtrace! I think the problem is when using 
> %e when some of the files have no extension. I've added t6075 to check 
> for this and pushed what should be a fix. Can you pull the latest 
> master and see if it helps? 
>
> Note that the current expected behavior when using %e with a file 
> without an extension is to fail with an error message, so your setup 
> will probably still fail (though ideally without the segfault this 
> time). We could probably define different semantics if you think 
> there's a compelling use-case for it. 
>
> I don't think I have extension-less files, but it seems like the code 
(very advanced debugging here..) doesn't like extlen < 0.

The following patch stopped the segfault, and let me carry on with business 
:)
--- a/src/tup/parser.c
+++ b/src/tup/parser.c
@@ -1964,7 +1964,7 @@ int execute_rule(struct tupfile *tf, struct rule *r, 
struct name_list *output_nl
                        /* The extension in do_rule() does not include the
                         * leading '.'
                         */
-                       if(do_rule(tf, r, &tmp_nl, ext+1, extlen-1, 
output_nl) < 0)
+                       if(extlen > 0 && do_rule(tf, r, &tmp_nl, ext+1, 
extlen-1, output_nl) < 0)
                                return -1;
 
                        if(is_bang) {


Also, poking around, if I turned on `-fsanitize=undefined`, I get some 
complaints that strcmp gets called with NULL pointers (also with 0 length, 
but evidently, no NULL is allowed). For debug builds, I really like the 
whole paranoid `-fsanitize` family, in addition to `-fstack-protector=all`.

I haven't looked around much, but tup is so far really nice to work with! 
Thanks a lot.

-Kristoffer
 

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to