bug-bash
[Top][All Lists]
Advanced

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

Re: Strange/incorrect behavior of a fake executable file


From: Eduardo Bustamante
Subject: Re: Strange/incorrect behavior of a fake executable file
Date: Wed, 14 Mar 2018 14:02:56 -0600

(I've added bug-bash again)

On Tue, Mar 13, 2018 at 11:32 PM, Vladimir Likic <address@hidden> wrote:
> Thanks for the quick response!

> Your are correct, "." was in PATH (my bad), an it's calling itself
> recursively. That went into a spiral and crashed the computer (literally).

> Why is bash actually executing the file without '!#' ?

[...]

On Tue, Mar 13, 2018 at 11:34 PM, Vladimir Likic <address@hidden> wrote:
> Sorry, meant why is bash executing the file without hash-bang '#!' ?

You can see the answer here:
http://git.savannah.gnu.org/cgit/bash.git/tree/execute_cmd.c?h=devel&id=bf5b8103d466fdbc3bfcdaa5e21a0d0c0dce7cba#n5608

Oversimplified explanation:

Bash performs the execve() system call on the executable file
(`junk'). If the system returns ENOEXEC (i.e. not an executable), bash
will then try to execute the file itself



reply via email to

[Prev in Thread] Current Thread [Next in Thread]