Very Strange

Denver Gingerich denver at ossguy.com
Wed Feb 6 14:05:29 UTC 2008


On Feb 6, 2008 1:28 AM, Kip Warner <kip at thevertigo.com> wrote:
> On Wed, 2008-02-06 at 00:22 -0600, Jordan Rudderham wrote:
> > Wow, that did work, thanks a bunch. I'm not sure I understand how that
> > works though. On other machines, if I compiled it in that working-direc,
> > I could then run the exe from that working-direc rather easily. What
> > makes the way I did this on ubuntu different?
>
> It should be like that on any system. When you type the name of a
> program, if it isn't in your path (e.g. on Windows or UNIX system), the
> system won't be able to find it. If it isn't in your path, but you know
> the complete or relative path to it, then you prefix the program name
> with that. Since the path to the current working directory is ./,
> typing ./a.out resolves the ambiguity. Hope that helps.

The reason that omitting the path to the current directory works on
Windows is that by default Windows includes the current directory in
your path.  On most UNIX-like systems, the path does not by default
include the current directory for security reasons (if you're root and
you type "ls" in someone's home directory and that directory that has
an malicious "ls" binary in it, the malicious "ls" binary would be
executed if the current directory is before /bin (or wherever the real
"ls" is) in your path).

I hope that clears things up.  Let us know if you have further questions.

Denver




More information about the ubuntu-ca mailing list