Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 May 2000 15:17:02 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Ben Smithurst <ben@scientia.demon.co.uk>
Cc:        Omachonu Ogali <oogali@intranova.net>, XF <gin@dds.nl>, Alex Kwan <freebsd-questions@FreeBSD.ORG>
Subject:   Re: A basic question about C programming (sloved)
Message-ID:  <Pine.BSF.4.21.0005141508440.86761-100000@ren.sasknow.com>
In-Reply-To: <20000514152939.R10128@strontium.scientia.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Ben Smithurst wrote to Omachonu Ogali:

> Omachonu Ogali wrote:
> 
> > On Sun, 14 May 2000, XF wrote:
> > 
> >> you have to give the PATH,
> > export PATH="$PATH:."
> 
> No.  Live with typing "./" when you need to.  Having "." in $PATH is
> dumb (so I wasn't surprised to see one of the Linux distributions had it
> like that by default).  What happens when you mis-type a command when
> you're in /tmp and someone has put a nasty script there?

Amen to that, Ben.  Adding the current directory to your $PATH IS a
foolish thing to do.  As a normal user, you can't damage much, but adding
. to root's path is virtually suicide, as you have already pointed out.

. in the path is arguably an MS-DOS thing to do, and it amounts to nothing
more than convenience for the lazy.  Users and administrators alike should
avoid ambiguity and potential slips/security problems and explicitly
specify ./ when executing commands in the current directory.  

Even with . at the end of your $PATH, you STILL need to specify ./ to
execute recompiled versions of common commands that exist elsewhere in
your path (or exist as builtin(1) commands).  Suppose you patch a utility
in /usr/src/usr.bin, recompile, and, having added . to the end of your
$PATH, scratch your head and wonder why your patch didn't take effect when
you simply type the command.

One could go on for quite some time on this topic... I merely wanted to
add my bit as further encouragement NOT to add . to any $PATH.

Virtually yours,
- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Systems Administrator, Accounts
  Phone: +1 (306) 664-1161

  SaskNow Technologies     http://www.sasknow.com
  #106-380 3120 8th St E   Saskatoon, SK  S7H 0W2



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0005141508440.86761-100000>