Re: [PATCH 2/2] config: clear the executable bits (if any) on $GIT_DIR/config

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

 



On 14.11.2014 23:26, Michael Haggerty wrote:
> There is no reason for $GIT_DIR/config to be executable, plus this
> change will help clean up repositories affected by the bug that was
> fixed by the previous commit.
> 
> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>
> ---
>  config.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 9e42d38..0942e5f 100644
> --- a/config.c
> +++ b/config.c
> @@ -1653,7 +1653,15 @@ int git_config_set_multivar_in_file(const char *config_filename,
>  			MAP_PRIVATE, in_fd, 0);
>  		close(in_fd);
>  
> -		if (chmod(lock->filename, st.st_mode & 07777) < 0) {
> +		/*
> +		 * We make of the executable bits because (a) it

We make *use* of

> +		 * doesn't make sense to have executable bits set on
> +		 * the config file, and (b) there was a bug in git 2.1
> +		 * which caused the config file to be created with u+x
> +		 * set, so this will help repair repositories created
> +		 * with that version.
> +		 */
> +		if (chmod(lock->filename, st.st_mode & 07666) < 0) {
>  			error("chmod on %s failed: %s",
>  				lock->filename, strerror(errno));
>  			ret = CONFIG_NO_WRITE;
> @@ -1832,7 +1840,7 @@ int git_config_rename_section_in_file(const char *config_filename,
>  
>  	fstat(fileno(config_file), &st);
>  
> -	if (chmod(lock->filename, st.st_mode & 07777) < 0) {
> +	if (chmod(lock->filename, st.st_mode & 07666) < 0) {
>  		ret = error("chmod on %s failed: %s",
>  				lock->filename, strerror(errno));
>  		goto out;
> 

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