6 ms·
Bash 5.2
- RealAlexClay 4y ago[info-gnu mirrors] bash: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00012.html https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00012... readline: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00013.html https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00013...
- gleenn 4y agoI had the pleasure of having the original writer of Bash, Brian Fox, at my programming language class in college one time. He was so pleasantly humble. I'll never forget how he said he wrote everything as simply as possible. Gem of a guy
- playingalong 4y agoWow. It's scary to think what if he didn't
- aliqot 4y agoWe'd be using Ash or Korn
- yjftsjthsd-h 4y agoWhen I've tried it, ksh has seemed decent. I don't know, however, whether that would have been true regardless or if it benefited from competition.
- aliqot 4y agoAs cliche as it sounds, you just kinda had to be there.
- yjftsjthsd-h 4y agoIn the sense that bash was better than ksh in a way that's difficult to articulate?
- aliqot 4y agoMore in the sense that at-the-time 'modern'[0] Linux eschewed a new set of tools that displaced/subverted those we used on other systems at the time. They can't be compared subjectively because it ignores a lot of the chronological nuance of the situation. It's not that one shell, or one OS was better than the other though there are objective measurements to prove one vs the other, it's the culmination of the social factors surrounding those societal shifts that resulted in what we now see as the 'better' tool coming out on top. We also cannot disregard the ancillary effects of being the favored shell on what is now the favored platform- more eyes more users more mindshare all helped to accelerate it to where it is now. I hope that hits the notes you were listenin for. [0] When I say 'modern' I'm not referring to the Ubuntus and GUI-first distros that we know today.
- chasil 4y agoThe POSIX shell actually devolved from Korn and bash. ksh88 worked very hard to compile its data segment in under 64k so it would work on Xenix running on a 286 and similarly constrained systems. The code was sphagetti gymnastics in achieving this. The POSIX shell standard removed many features of the ksh88 language. It appears that this was done in an attempt to maintain a small footprint, but clarify the code. This is good for embedded systems, but bad if you need arrays.
- deleted 4y ago[deleted]
- tinglymintyfrsh 4y agoWoah nice. I use Zsh most of the time, but the OG's of *NIX and POSIX/C bring back the mindset of portability and simplicity. If we only could've leapt from FORTRAN to Rust and skipped C and C++. ;)
- pjmlp 4y agoThat was Ada in 1983. :)
- etaioinshrdlu 4y agoHumble is not a word that comes to mind when thinking of Brian. Epic-troll is maybe a better one. Now he has pivoted to crypto-coin pumper.
- exabyte 4y agoi bet he's a man of multitudes
- imglorp 4y agoAnd I went to school (Case) with the other half of Bash, Chet Ramey. I think Brian focused more on Readline and Chet was more on Posix.
- pstuart 4y agoImprovements are always nice but portability matters, so depending on new features isn't possible until it could safely be assumed to be ubiquitous (cough, not you Apple). Then there's the part where building anything of any significant complexity is not probably a good idea in a shell script.
- gogoyubari 4y agoThere are circumstances in which portability is not required. People have been writing bash before Apple picked it up and people keep writing bash despite Apple getting sent to GNUlag by GPLv3.
- chasil 4y agoIf portability is your primary concern, then you want a POSIX shell, or at least to ensure that your bash is always in POSIX mode. There are lots of behavior differences when bash's POSIX mode is set. Debian brought the Almquist shell in as /bin/sh, and is maintaining it with strict compliance to POSIX. This displaces bash as the system shell, but bash is still assigned as the interactive shell. http://gondor.apana.org.au/~herbert/dash/ http://gondor.apana.org.au/~herbert/dash/ This is an older standard for the behavior of the POSIX shell. There are many common shell features that are not here (arrays, networking, coprocesses, fancy substitution, and much more). Doing without them increases portability. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
- rwmj 4y agoIn my view Debian boiled an ocean for no discernable gain and caused a lot of trouble for everyone in the process. Fedora is using bash and I hope we continue rejecting the mistake Debian made.
- chasil 4y agoDebian dash is useful to keep my scripts honest. Busybox actually takes dash, and then sprinkles a few bash/korn features back onto it (notibly, not arrays). If you want a lot of people to use your scripts, getting them working in dash can help a great deal. The POSIX mode in bash exists because bash itself predates POSIX by nearly a decade.
- gberger 4y agoDoes anyone have a TLDR of major changes or fixes?
- eklitzke 4y agoThe most notable new feature is the rewritten command substitution parsing code, which calls the bison parser recursively. This replaces the ad-hoc parsing used in previous versions, and allows better syntax checking and catches syntax errors much earlier. The shell attempts to do a much better job of parsing and expanding array subscripts only once; this has visible effects in the `unset' builtin, word expansions, conditional commands, and other builtins that can assign variable values as a side effect. The `unset' builtin allows a subscript of `@' or `*' to unset a key with that value for associative arrays instead of unsetting the entire array (which you can still do with `unset arrayname'). There is a new shell option, `patsub_replacement'. When enabled, a `&' in the replacement string of the pattern substitution expansion is replaced by the portion of the string that matched the pattern. Backslash will escape the `&' and insert a literal `&'. This option is enabled by default. Bash suppresses forking in several additional cases, including most uses of $(<file).
- xcambar 4y agoIsn't it what the link provides?
- pigeons 4y agoThat's literally what the link gives! :)
- mdeeks 4y agoWell they asked for a TL;DR. The link is three pages of dense text and much of it isn't major changes. Seems reasonable for to ask for a summary of the big changes.
- johnklos 4y ago@jhamby on Twitter is currently refactoring bash to c++, and it's really interesting to read anecdotes about it and read about the progress. It's a really interesting codebase.
- beembeem 4y agolink to in-progress source?
- beembeem 4y agofound it here: https://github.com/jhamby/bashcpp https://github.com/jhamby/bashcpp
- svnpenn 4y agoFYI I wouldn't recommend browsing that guys feed. He has some strange posts on it.
- no_time 4y agoHis posts seem sane to me. The sheer volume of them is a bit weird though.
- dolni 4y agoYou would recommend against browsing his feed because some of his posts are "strange"? Seems like an unnecessary callout.
- svnpenn 4y agoThanks for you opinion. Am I allowed to have one as well?
- bheadmaster 4y agoRecommending that other people avoid a certain page because it contains "strange posts" without further elaboration is definitely inviting the "unnecessary callout" remark. As HackerNews is a discussion site, not your personal blog, some further elaboration on why you consider the guy's posts "strange" (and why you even consider "strange" being a bad thing in itself) would be in order.
- csdvrx 4y agoFor bash users who are tempted by zsh interactive "fuzzy" completion, here's my take on it: it's directory-aware (offering different suggestions based on your history of commands in that given directory), pure bash code using sqlite to store data: https://github.com/csdvrx/bash-timestamping-sqlite https://github.com/csdvrx/bash-timestamping-sqlite The only other dependency is fzy for fuzzy matching.
- gogoyubari 4y agoNice, there's also ble.sh -- a bash replacement of readline that has zsh/fish-like syntax colors and completion. It is actively developed and the maintainer has implemented 2 features I've requested in a matter of hours. If you want to check it out: https://github.com/akinomyoga/ble.sh https://github.com/akinomyoga/ble.sh (Still, I personally believe these features are overrated and don't actually bring in more usability or comfort to the command line experience. For instance, ctrl+r kills the need for suggestions and instead of selecting files scrolling through them with your fingers, you can select them using your eyes?)
- csdvrx 4y ago> there's also ble.sh I tried. It was a source of inspiration for the looks, because it looks really nice! However, due to some design decisions ble.sh is slow to the point of being unusable on some hardware I use, including a modern laptop running msys2 instead of WSL2 > For instance, ctrl+r kills the need for suggestions Use both: seed your history search with the path and a few keywords, then sort by frequency of how often it was the correct or successful complete in the past (meaning it gave you a non error return code)
- sprash 4y ago> slow to the point of being unusable ble.sh has a vast array of configuration options. By disabling features I didn't like or need I was able to make it run pretty fast and responsive.
- 4y ago
- AdmiralAsshat 4y ago> a. The bash malloc returns memory that is aligned on 16-byte boundaries. Why the heck does bash need malloc?
- edgyquant 4y agoFor systems without one provided.
- AdmiralAsshat 4y agoMaybe I'm misunderstanding the note. Does this mean that the bash source code (written in C, I assume) now uses its own `malloc` function instead of what is provided by the standard C library? Or is it saying that `malloc` is a command I can call in bash? I assumed the latter, and couldn't figure out why I would need to manually allocate memory in a shell script.
- pyuser583 4y agoThere’s no malloc bash command. The idea is that you don’t need C libraries to run/compile bash.
- Beltalowda 4y agoI don't think you can compile bash without a libc. The idea is that back in the day systems didn't always come with a good malloc, so bash provided its own. These days, you want --without-bash-malloc on pretty much all modern systems (where "modern" means "last 20 years"). It was a good idea 30+ years ago, maybe. It's really old and crufty code; last time I checked it's all in pre-ANSI C and with workarounds for platforms like 1980s Xenix.
- e12e 4y agoYes, I think this is accurate: https://www.gnu.org/software/bash/manual/html_node/Optional-Features.html https://www.gnu.org/software/bash/manual/html_node/Optional-... > --with-bash-malloc > Use the Bash version of malloc in the directory lib/malloc. This is not the same malloc that appears in GNU libc, but an older version originally derived from the 4.2 BSD malloc. This malloc is very fast, but wastes some space on each allocation. This option is enabled by default. The NOTES file contains a list of systems for which this should be turned off, and configure disables this option automatically for a number of systems. > --with-gnu-malloc > A synonym for --with-bash-malloc. http://git.savannah.gnu.org/cgit/bash.git/tree/NOTES?h=devel http://git.savannah.gnu.org/cgit/bash.git/tree/NOTES?h=devel > Platform-Specific Configuration and Operation Notes [very dated] > 1. configure --without-gnu-malloc on: > alpha running OSF/1, Linux, or NetBSD (malloc needs 8-byte alignment; > bash malloc has 8-byte alignment now, but I have no alphas to test on) > next running NeXT/OS; machines running Openstep > all machines running SunOS YP code: SunOS4, SunOS5, HP/UX, if you have problems with username completion or tilde expansion for usernames found via YP/NIS > linux (optional, but don't do it if you're using Doug Lea's malloc) > QNX 4.2 > other OSF/1 machines (KSR/1, HP, IBM AIX/ESA) > AIX > sparc SVR4, SVR4.2 (ICL reference port) > DG/UX > Cray > Haiku OS > NetBSD/sparc (malloc needs 8-byte alignment; bash malloc has 8-byte alignment now, but I have no NetBSD machines to test on) > BSD/OS 2.1, 3.x if you want to use loadable builtins > Motorola m68k machines running System V.3. There is a file descriptor leak caused by using the bash malloc because closedir(3) needs to read freed memory to find the file descriptor to close
- Aissen 4y agoBash nowadays is developed in git, which is nice. Good luck finding incremental changes, though: https://git.savannah.gnu.org/cgit/bash.git/commit/?id=74091dd4e8086db518b30df7f222691524469998 https://git.savannah.gnu.org/cgit/bash.git/commit/?id=74091d... https://git.savannah.gnu.org/cgit/bash.git/commit/?id=8868edaf2250e09c4e9a1c75ffe3274f28f38581 https://git.savannah.gnu.org/cgit/bash.git/commit/?id=8868ed... https://git.savannah.gnu.org/cgit/bash.git/commit/?id=d233b485e83c3a784b803fb894280773f16f2deb https://git.savannah.gnu.org/cgit/bash.git/commit/?id=d233b4... (to be fair there are a few smaller patchsets beside these huge dumps; and it does have a good documentation and changelog file). This alone was enough to push me towards fish for my interactive shell needs.
- kazinator 4y agoI quickly found the details on a branch called devel. It looks like Ramey is doing rebasing merges with squashing to get changes into the trunk. Moreover, there is an intermediate 5.2-test branch which doesn't have the details commits, but is less squashed; it has the 5.2 intermediate pre-releases that were put out for testing. So there is a method to the madness, though I can't personally agree with anything except all changes on one straight line that you can git bisect with your eyes closed. All those items like 5.2 prerelease 3 can just be tags on one trunk. Here is a problem: the devel branch has no tags indicating where the various intermediate releases were cut. Likewise, the squash merge commits do not list, in the commit message, the range of commits that were included.
- Aissen 4y agoWow, thanks for the pointer to the devel branch. I retract some of my criticism, this seems to be done fairly properly (except in 2021 when I looked where the commits where basically time dumps). I don't get the need to squash though.
- kazinator 4y agoI'm going to open an outright bug on Savannah for this. It's a process problem in the Bash project that I can't go into the detailed devel branch where the acctual commits are, and tell which are the commits that have gone into specific test baselines and releases. https://savannah.gnu.org/support/index.php?110734 https://savannah.gnu.org/support/index.php?110734
- hsbauauvhabzb 4y agoI’ve asked before on hn and will ask again, I’m sure a bash core dev said something along the lines of ‘if you want a secure shell don’t use bash’, I’d love to see the original quote, and context so I can cite it formally. To be clear, I think this was in reference to shell shock and not a generic statement. Bash has its place, I think everyone agrees that place isn’t cgi scripts though.
- chasil 4y agoThe grammar of the POSIX shell (and derivatives) is not an LR-parsed language that can be implemented with yacc. It requires an advanced parser. There is an effort with OCaml (and another with ADA) to create a formal and secure parser. They remark that dash is a handcrafted parser in C that cannot be formally assured. https://archive.fosdem.org/2018/schedule/event/code_parsing_posix_s_hell/ https://archive.fosdem.org/2018/schedule/event/code_parsing_... https://archive.fosdem.org/2019/schedule/event/ada_shell/ https://archive.fosdem.org/2019/schedule/event/ada_shell/
- stjohnswarts 4y agocgi scripts... now that's a name I haven't heard in a long time...
- arpa 4y agoi disagree. My webserver is written in bash.
- hsbauauvhabzb 4y agoAh yes, one self certified ‘secure’ app proves the language is secure. I think arguing that you’ll have a hard time arguing that weakly typed, structureless, idiosyncratic language is secure.
- arpa 4y agoit is never the language, it's the implementation. But y'all software "engineers" parrot the same shite since 1989