Re: [PATCH] attr: fix off-by-one directory component length calculation
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jan 16, 2013, 01:08 UTC
- Message-ID
- <CACsJy8Bn4GKJzi4n5cMPp+26dovT795nUqcXGNLgapf+r_PFCw@mail.gmail.com>
- In-Reply-To
- <7vwqve2qk3.fsf@alter.siamese.dyndns.org>
On Wed, Jan 16, 2013 at 2:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> "Jean-Noël AVILA" <avila.jn@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", notActually I'd like to remove that function. The function is called twice:
- collect_all_attrs
+ prepare_attr_stack
* find_basename
+ find_basenamewhich could be reordered to
- collect_all_attrs + find_basename + prepare_attr_stack (modified to take dirlen from caller)
and because that'll be the only place find_basename is used, we could just inline the code there.
-- Duy