From: Alexandr Miloslavskiy Date: Fri, 06 Mar 2020 22:54:38 GMT Subject: Re: [PATCH 2/4] real_path: remove unsafe API Message-ID: In-Reply-To: On 06.03.2020 23:12, Junio C Hamano wrote: > If my reading of the code is correct, however, the first thing that > is done by strbuf_realpath() is to empty the output buffer by using > strbuf_reset() indirectly via get_root_part(). Calling strbuf_reset() > here should not hurt, but it is unnecessary, I would think. An even > worse effect such a redundant strbuf_reset() has is that by repeatedly > seeing the "reset then call realpath" pattern, readers who do not read > the implementation of strbuf_realpath() might mistakenly think that > > strbuf_addf(&message, "the path '%s' is really ", path); > strbuf_realpath(&message, path); > > is how realpath() is expected to be used, i.e. keep the current > contents in the buffer and append the resolved path to it. Thanks, will change in V2 next week.