Timeline for About the .file and ./directory confusion
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 9, 2014 at 6:11 | comment | added | mrr | It's not difficult to write ./, and you don't know what is in your directories: ANYTHING could be in them, you almost certainly haven't reviewed the source code of everything running on your system. | |
| May 7, 2014 at 12:05 | comment | added | orion | @MilesRout I know what I'm doing on my own computer, and I'm aware of the contents of my directories. I regulate what's made executable. I neved do this for root account (reckless), but as a user, always. Almost every directory has some locally important scripts and it makes sense that giving a command shouldn't require a prefix, just like for global scripts. I'm not trying to argue, just giving you reasoning for my decision. | |
| May 4, 2014 at 21:50 | comment | added | mrr | @orion Absolutely not, that's a security hole. | |
| May 4, 2014 at 17:58 | comment | added | phemmer | @WarrenYoung We know the phrasing in the question is ambiguous. This has been pointed out by n.st's interpretation of the question. I'm trying to point out that my answer says "This is shell notation meaning to execute the file called configure in the current working directory", which is unambiguous. My answer specifically talks about $PATH and the need for qualifying commands not in $PATH. I've even proved that this is handled differently by the shell by providing source code. | |
| May 4, 2014 at 14:55 | comment | added | Warren Young | @orion: Your guess is right, it is a security hole, and that is sufficient reason not to add . to the PATH. It's right up there with always encrypting mobile computers. | |
| May 4, 2014 at 14:10 | comment | added | orion | Also, the first thing to do if you are doing any development beyond clicking user interfaces, is to put . into the $PATH. It's not there by default, probably for historical or security reasons (in case the user is clueless), but it should have been. | |
| May 4, 2014 at 10:09 | comment | added | phemmer | @WarrenYoung From that same dictionary: "Distinct among others of a kind". A command with a / is treated differently than one without a slash. Thus it is special. :-) | |
| May 4, 2014 at 6:18 | comment | added | phemmer | @WarrenYoung I never said you need the shell to invoke a program with / in the name. Where did you get that from? I said that ./ is special shell notation. When you pass a command to the shell that has a / in the name, it does not use $PATH. Here's the source code to prove it: findcmd.c:344 calls absolute_program which is defined at general.c:608. | |
| May 4, 2014 at 1:24 | comment | added | Mike Lippert | hmm, I wouldn't call it a shell notation either. It's just a relative path to the file. The key difference between linux and Windows in this regard is that in Windows, the current directory is always considered first in the PATH w/o actually being listed there. In linux (well bash at least) the current directory isn't in the path unless you explicitly put it there. You can execute a file either by typing it's name if it will be found on the PATH, or by giving the path to that file. The path you type can be absolute (starting w/ /) or relative. | |
| May 4, 2014 at 0:41 | comment | added | phemmer | @WarrenYoung It actually is shell notation. POSIX Command Search and Execution, see the bit about "If the command name contains at least one slash" | |
| May 4, 2014 at 0:03 | history | answered | phemmer | CC BY-SA 3.0 |