[Top][All Lists]

[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: Tue, 13 Mar 2018 22:29:22 -0600

On Tue, Mar 13, 2018 at 7:24 PM, Vladimir Likic <address@hidden> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -Wdate-time
> -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-7fckc0/bash-4.4=.
> -fstack-protector-strong -Wformat -Werror=format-security -Wall -no-pie
> -Wno-parentheses -Wno-format-security
> uname output: Linux sparky 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3
> (2018-03-02) x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> Description:
> A strange/unexpected behavior when one creates a file with a single line
> that is identical to the name of the file, gives exec permissions and
> attempts to run the file.
> Repeat-By:
> $ echo junk > junk
> $ chmod +x junk
> $./junk
> --> this completely destroys my system

Uh, what do you mean by that? And how is this a bash bug?

A few points:

1) You do not provide a hash-bang (i.e. #!/bin/bash), which means that
/bin/sh will be used (
2) You are using Debian apparently. /bin/sh in Debian is dash, not bash
3) What's the value of PATH? (I'm guessing you have an empty entry or
'.' in there, and therefore, the script calls itself recursively).
It's not good practice to have the current working directory in your
PATH, so, fix that.

reply via email to

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