Re: [PATCH v2 4/6] t5701: add setup test to remove side-effect dependency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux