Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #163205

Re: eagle-lin64-7.5.0.run, won't

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: eagle-lin64-7.5.0.run, won't
Date 2016-01-17 14:10 +0100
Message-ID <qRVfK-2SA-29@gated-at.bofh.it> (permalink)
References (5 earlier) <qRBAo-6Ad-53@gated-at.bofh.it> <qRBK2-6DH-15@gated-at.bofh.it> <qRBTJ-6HN-41@gated-at.bofh.it> <qRCd3-6Po-3@gated-at.bofh.it> <qRCd3-6Po-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Jan 16, 2016 at 09:45:58AM -0700, Brandon Vincent wrote:
> On Sat, Jan 16, 2016 at 9:42 AM, Curt <curty@free.fr> wrote:
> > Thank you for your time. Just another misapprehension I've been laboring
> > under these many years.
> 
> I actually linked to the wrong article. I've never been able to find
> actual Bash documentation that states this.
> 
> It just has always worked.

It's just there in the manual (referring to info bash):

  3.7.2 Command Search and Execution
  ----------------------------------
  
  After a command has been split into words, if it results in a simple
  command and an optional list of arguments, the following actions are
  taken.
  
    1. If the command name contains no slashes, the shell attempts to
       locate it.  If there exists a shell function by that name, that
       function is invoked as described in *note Shell Functions::.
  
    2. If the name does not match a function, the shell searches for it in
       the list of shell builtins.  If a match is found, that builtin is
       invoked.
  
    3. If the name is neither a shell function nor a builtin, and contains
       no slashes, Bash searches each element of '$PATH' for a directory
       containing an executable file by that name.  Bash uses a hash table
       to remember the full pathnames of executable files to avoid
       multiple 'PATH' searches (see the description of 'hash' in *note
       Bourne Shell Builtins::).  A full search of the directories in
       '$PATH' is performed only if the command is not found in the hash
       table.  If the search is unsuccessful, the shell searches for a
       defined shell function named 'command_not_found_handle'.  If that
       function exists, it is invoked with the original command and the
       original command's arguments as its arguments, and the function's
       exit status becomes the exit status of the shell.  If that function
       is not defined, the shell prints an error message and returns an
       exit status of 127.
       [...]

That means that all the "special handling" (i.e. looking up a shell
function, going through $PATH, etc.) only happens when the command
contains no slashes. It's only for those cases where you'd need a
"." in $PATH if you want commands in the current directory executed
right away, a custom which is discouraged, because it's too easily
a vector for exploits[1] (it used to be standard behaviour under DOS,
which was one of the surprises for DOS migrants).

If you call the "local" command ./foo, then it contains slashes, so
special behaviour doesn't apply.

- - - - - - - - - - - - - - - - -
[1] Eve puts an executable shell script under /tmp named `ls',
    containing the line "rm -Rf $HOME/". Alice does:

      cd /tmp
      ls

    and is henceforth homeless.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlabiJgACgkQBcgs9XrR2kYe1gCdHPlM549sUht/gGW6R87YYE6S
+TMAnAshVl3y6mGei4RHesn1UrQeX1e5
=72Wo
-----END PGP SIGNATURE-----

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-15 00:40 +0100
  Re: eagle-lin64-7.5.0.run, won't Brandon Vincent <Brandon.Vincent@asu.edu> - 2016-01-15 01:40 +0100
    Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-15 03:40 +0100
  Re: eagle-lin64-7.5.0.run, won't Anders Andersson <pipatron@gmail.com> - 2016-01-15 06:10 +0100
    Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-15 06:30 +0100
  Re: eagle-lin64-7.5.0.run, won't Chris Bannister <cbannister@slingshot.co.nz> - 2016-01-16 05:40 +0100
    Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-16 07:10 +0100
      Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-16 11:10 +0100
        Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-16 12:00 +0100
          Re: eagle-lin64-7.5.0.run, won't Brandon Vincent <Brandon.Vincent@asu.edu> - 2016-01-16 14:10 +0100
            Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-16 18:20 +0100
              Re: eagle-lin64-7.5.0.run, won't Joe <joe@jretrading.com> - 2016-01-17 01:50 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-17 02:30 +0100
                Re: eagle-lin64-7.5.0.run, won't Joe <joe@jretrading.com> - 2016-01-17 15:50 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-17 23:30 +0100
                Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-17 23:40 +0100
          Re: eagle-lin64-7.5.0.run, won't Curt <curty@free.fr> - 2016-01-16 17:00 +0100
            Re: eagle-lin64-7.5.0.run, won't Brandon Vincent <Brandon.Vincent@asu.edu> - 2016-01-16 17:10 +0100
              Re: eagle-lin64-7.5.0.run, won't Curt <curty@free.fr> - 2016-01-16 17:20 +0100
                Re: eagle-lin64-7.5.0.run, won't Brandon Vincent <Brandon.Vincent@asu.edu> - 2016-01-16 17:30 +0100
                Re: eagle-lin64-7.5.0.run, won't Brandon Vincent <Brandon.Vincent@asu.edu> - 2016-01-16 17:50 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-16 18:50 +0100
                Re: eagle-lin64-7.5.0.run, won't <tomas@tuxteam.de> - 2016-01-17 14:10 +0100
                Re: eagle-lin64-7.5.0.run, won't Curt <curty@free.fr> - 2016-01-16 17:50 +0100
            Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-16 18:30 +0100
              Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-16 23:50 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-17 02:20 +0100
                Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-17 03:10 +0100
                Re: eagle-lin64-7.5.0.run, won't <tomas@tuxteam.de> - 2016-01-17 14:10 +0100
                Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-17 15:00 +0100
              Re: eagle-lin64-7.5.0.run, won't David Wright <deblis@lionunicorn.co.uk> - 2016-01-17 04:30 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-17 05:50 +0100
              Re: eagle-lin64-7.5.0.run, won't Chris Bannister <cbannister@slingshot.co.nz> - 2016-01-17 15:20 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-17 23:30 +0100
                Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-17 23:40 +0100
                Re: eagle-lin64-7.5.0.run, won't Chris Bannister <cbannister@slingshot.co.nz> - 2016-01-19 11:00 +0100
                Re: eagle-lin64-7.5.0.run, won't Lisi Reisz <lisi.reisz@gmail.com> - 2016-01-19 12:40 +0100
                Re: eagle-lin64-7.5.0.run, won't Darac Marjal <mailinglist@darac.org.uk> - 2016-01-19 14:10 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-19 15:50 +0100
                Re: eagle-lin64-7.5.0.run, won't Chris Bannister <cbannister@slingshot.co.nz> - 2016-01-19 18:00 +0100
                Re: eagle-lin64-7.5.0.run, won't Cindy-Sue Causey <butterflybytes@gmail.com> - 2016-01-19 14:00 +0100
                Re: eagle-lin64-7.5.0.run, won't Gene Heskett <gheskett@shentel.net> - 2016-01-19 15:50 +0100

csiph-web