"Jean-Noël AVILA" <avila...@gmail.com> writes:

> Thank you for the explanation.
>
> I did not monitor the system calls when writing that patch. 
> Where is the perf framework?
>
> As the mistake is located in the "find_basename" function, I would propose a 
> fix directly into it so that the output fits what the other functions expect.

Isn't that a crazy semantics for the function, though?  I would
expect find_basename("/a/path/to/file") to return "file", not
"/file".

>
> Something in the line of:
>
> diff --git a/attr.c b/attr.c
> index d6d7190..b6e72f3 100644
> --- a/attr.c
> +++ b/attr.c
> @@ -572,7 +572,7 @@ static const char *find_basename(const char *path)
>                 if (*cp == '/' && cp[1])
>                         last_slash = cp;
>         }
> -       return last_slash ? last_slash + 1 : path;
> +       return last_slash ? last_slash : path;
>  }
>  
>  static void prepare_attr_stack(const char *path)
> @@ -770,6 +770,10 @@ static void collect_all_attrs(const char *path)
>                 check_all_attr[i].value = ATTR__UNKNOWN;
>  
>         basename = find_basename(path);
> +       /* the slash is included in the basename
> +          so that it can be matched by a directory pattern */
> +       if (basename != path)
> +               basename++;
>         pathlen = strlen(path);
>         rem = attr_nr;
>         for (stk = attr_stack; 0 < rem && stk; stk = stk->prev)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to