Re: [PATCHv5 16/16] Introduce portable_unset and use it to ensure proper && chaining

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

 



Elijah Newren wrote:

> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -268,6 +268,10 @@ remove_cr () {
>  	tr '\015' Q | sed -e 's/Q$//'
>  }
>  
> +portable_unset () {
> +	unset $* || true
> +}

I think this should read

	portable_unset () {
		unset "$@"
		return 0
	}

(or || true).  That is, if I try

	portable_unset "foo bar"

then on platforms where an envvar named "foo bar" is allowed,
this should unset it, no?

Also, maybe a comment could guide people in using this:

	# In some bourne shell implementations, the "unset" builtin
	# returns nonzero status when a variable to be unset was not
	# set in the first place.
	#
	# Use portable_unset when that should not be considered an
	# error.

An update to t/README would be nice, too. :)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]