RE: [BUG] t1800: Fails for error text comparison

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

 



On September 7, 2022 5:56 PM, Junio C Hamano wrote:
><rsbecker@xxxxxxxxxxxxx> writes:
>
>> I am finding an issue with t1800.16 failing as a result of a text
compare:
>>
>> -fatal: cannot run bad-hooks/test-hook: ...
>> +fatal: cannot exec 'bad-hooks/test-hook': Permission denied
>>
>> I don't think this is actually a failure condition but the message
>> text is platform and shell specific.
>
>Isn't this coming from piece of code in start_command()?
>
>		/*
>		 * Attempt to exec using the command and arguments starting
at
>		 * argv.argv[1].  argv.argv[0] contains SHELL_PATH which
will
>		 * be used in the event exec failed with ENOEXEC at which
point
>		 * we will try to interpret the command using 'sh'.
>		 */
>		execve(argv.v[1], (char *const *) argv.v + 1,
>		       (char *const *) childenv);
>		if (errno == ENOEXEC)
>			execve(argv.v[0], (char *const *) argv.v,
>			       (char *const *) childenv);
>
>		if (errno == ENOENT) {
>			if (cmd->silent_exec_failure)
>				child_die(CHILD_ERR_SILENT);
>			child_die(CHILD_ERR_ENOENT);
>		} else {
>			child_die(CHILD_ERR_ERRNO);
>		}
>
>The test apparently expects CHILD_ERR_NOENT, which comes from
>child_err_spew()
>
>	case CHILD_ERR_ENOENT:
>		error_errno("cannot run %s", cmd->args.v[0]);
>		break;
>	case CHILD_ERR_SILENT:
>		break;
>	case CHILD_ERR_ERRNO:
>		error_errno("cannot exec '%s'", cmd->args.v[0]);
>		break;
>	}
>
>but somehow your system fails the execve() with something other than
ENOENT.

The file exists but could not be executed. EPERM was returned. The reason is
that test-hooks exists and contains:

#!/bad/path/no/spaces

which does not exist. This (correctly IMO) translates to EPERM not ENOENT
because the test-hooks file exists but cannot be executed due to the
underlying failure. The underlying ENOENT is hidden.




[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