This is obviously deliberate, and I see similar code (without the posixly_correct condition) in bash 1.05 from 1990.
According to Wikipedia, POSIX began in 1988, and the initial
release of bash was in 1989, just a year later. Obviously the
authors thought that expanding literal '~'s in $PATH was a good
idea at the time, and it's not suprising that they didn't pay much
attention to POSIX. It would have been nice if they'd documented it.
On 2025-01-26, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
This is obviously deliberate, and I see similar code (without the
posixly_correct condition) in bash 1.05 from 1990.
According to Wikipedia, POSIX began in 1988, and the initial
release of bash was in 1989, just a year later. Obviously the
authors thought that expanding literal '~'s in $PATH was a good
idea at the time, and it's not suprising that they didn't pay much
attention to POSIX. It would have been nice if they'd documented it.
In recent years, I've been wondering about the early history of
Bash, but cursory searches came up empty. Versions before 1.14
have even been expunged from ftp.gnu.org.
My vague impression is that Bash started as an attempt to combine
csh and sh, but it's not clear to me how soon people noticed the infeasibility and pivoted to a sh-based model. Or maybe that's not
at all how it happened.
If anybody has pointers to the early history or old source code,
I'd love to know.
My vague impression is that Bash started as an attempt to combine
csh and sh, but it's not clear to me how soon people noticed the infeasibility and pivoted to a sh-based model. Or maybe that's not
at all how it happened.
... (also implied by the name "Bourne Again SHell" ...
I don't suspect this problem intersects with the issue we are talking
about, but it's hard to be sure about a negative without doing a bunch
of work.
The ability to use a Unicode slash in a filename on POSIX systems,
thanks to UTF-8, is mostly a good thing, in my view.
Back these days someone had pointed out that it's actually helpful
if you have only few restrictions ('\0' and '/') on characters; it
makes it possible to support "non-ASCII file systems" based on that underlying primitive design. - That's certainly a valid point.
The point (made upthread) with the non-ASCII slash character makes
me doubt, though. Wouldn't such exploits like you constructed with
the "literal '~'" topic be also possible with "fake" slashes?
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 60 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 04:25:48 |
| Calls: | 812 |
| Files: | 1,289 |
| D/L today: |
8 files (5,275K bytes) |
| Messages: | 213,836 |