On Sat, Jan 18, 2025 at 1:02 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Usman Akinyemi <usmanakinyemi202@xxxxxxxxx> writes: > > > -test_expect_success 'test capability advertisement' ' > > +test_expect_success 'setup to generate files with expected content' ' > > + printf "agent=git/$(git version | cut -d" " -f3)" >agent_and_osversion && > > Is this required to be "printf" and not "echo", if so why? > > "git version" could contain any character if the builder gives a > custom version string by saving it in the "version" file (we use the > mechanism when we create a distribution tarball, for example). What > happens if it contains say "%s" or something? There is not any requirement to use "printf" here, I did not think about this case before, I will change it to "echo" > > If you _really_ need to use printf, you'd want to do so more like: > > printf "agent=git/%s" "$(git version | cut ...)" > > Is it required that agent_and_osversion lack the terminating LF? > The use of printf without terminating "\n" at the end of the format > string hints the readers that it is the case. If you did not intend > that, perhaps doing > > printf "agent=git/%s\n" "$(git version | cut ...)" > > would avoid misleading them. Yeah, that is true, I could not notice this as the next commit of the patch series was able to fix it. I will change it to "echo", with this, it will be better. Thank you.