Re: [arch-general] dash as default shell?
On 6/18/20 12:11 AM, David C. Rankin wrote: > On 06/17/2020 01:18 PM, Piscium via arch-general wrote: >> Today I set dash as my default shell [1] on two PCs. We will see if I >> get into trouble. >> >> This question was asked years ago but maybe good to ask again. Could >> dash be made the default shell in Arch? > > Please NO. Bash has been the default, and while there is nothing wrong with a > Bourne-again (or Debian Almquist) type shell, it would break more than a > decade of setups... > > If you want Dash, make the change after install. You pulled this assertion out of thin air, do you have any proof that it "breaks more than a decade of setups"? Note that as has already been pointed out, any setup which it breaks is inherently flawed, and in addition was broken on Debian, the most popular linux distribution by sheer numbers, as well as most non-Linux forms of Unix. It's actually in practice very unlikely that this will break anyone's setup. Also if you really think Arch Linux is afraid to break people's setups, I suggest you reread https://www.archlinux.org/news/python-is-now-python-3/ -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On 06/17/2020 01:18 PM, Piscium via arch-general wrote: > Today I set dash as my default shell [1] on two PCs. We will see if I > get into trouble. > > This question was asked years ago but maybe good to ask again. Could > dash be made the default shell in Arch? Please NO. Bash has been the default, and while there is nothing wrong with a Bourne-again (or Debian Almquist) type shell, it would break more than a decade of setups... If you want Dash, make the change after install. -- David C. Rankin, J.D.,P.E.
Re: [arch-general] dash as default shell?
I would want the default /bin/sh shell to be dash just for the sake of standardization. Also no one really expects /bin/sh to be bash, that alone is confusing for some people (myself included). Josef Miegl signature.asc Description: PGP signature
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On 6/17/20 3:54 PM, Kusoneko wrote: > It has the cost that everyone who uses scripts that use bashisms will > inevitably have issues, furthermore, considering Arch only supports > x86_64, I've yet to see systems under that architecture have low > amounts of memory and 6MB of disk storage is incredibly small. The > real question here is "Is it worth forcing people to remove bashisms > or specify that the script is meant for bash in their scripts > (whichever ones don't do so already) for a speed improvement on a > shell scripts that work with dash?" Note that some upstreams will > likely not care, and maintainers will have to patch the scripts > manually in that case. Debian/Ubuntu has extensive prior art in this matter. It was very important and resulted in very noticeable speed improvements on x86_64 systems with lots of memory and disk storage, because pid 1 used to be shellscripts and doing it in bash is slow and gets even slower the more you fork new scripts. :) Also Linux isn't everything :) and there are plenty of systems where bash is not installed by default. e.g. the *BSDs. Also also, bash is not installed on systems such as alpine linux. So any script assuming /bin/sh is bash, is broken on lots of systems. ... This is not actually a problem, I've used dash as my /bin/sh for years and haven't once encountered a broken script. -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On Wed, 17 Jun 2020 at 21:21, brent s. wrote: > Now, to init- because Arch uses systemd (and, yes, now Debian and > Ubuntu), one must wonder what benefit, if any, this actually serves. > systemd invokes the command directly, it does not spawn a shell to run > an init script like sysvinit, upstart, openrc, etc. This is, primarily, > the purpose of the system shell. > > I don't really see much of a benefit to it being that Arch uses systemd. > Granted, it probably wouldn't harm much either given the purpose of the > system shell, and probably why those who have already changed it haven't > seen any noticeable effects. It just seems like an unnecessary change. It's a good point you made that with systemd there are less benefits of a fast /bin/sh. Ubuntu made its switch to dash in 2006 [1] and Debian in 2011 [2], [3], and they switched to systemd later in 2013 and 2012, respectively [4]. But switching to dash would also be about security, as less code means less bugs [5]. I found only one CVE for dash, an old one when dash is used as a login shell [7]. There are a number of bash bugs but they tend to be in various devices that are not necessarily using the latest bash version so most would not apply to Arch (it would take a long time to go through the list [8] in detail so I won't do it). [1] https://wiki.ubuntu.com/DashAsBinSh [2] https://wiki.debian.org/Shell [3] https://www.debian.org/News/2011/20110205a [4] https://en.wikipedia.org/wiki/Systemd#Adoption [5] https://lwn.net/Articles/614218/ [6] https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=bash [7] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0854 [8] https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=bash+
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On 17/06/2020 22:54, Kusoneko wrote: > It has the cost that everyone who uses scripts that use bashisms will > inevitably have issues, Anybody who is using Bash features with /bin/sh shebang is wrong anyway. Want Bash features? Use #!/bin/bash Want simpler POSIX-compatible shell that is also faster? Use #!/bin/sh Do not care? Use #!/bin/bash > furthermore, considering Arch only supports x86_64, I've yet to see > systems under that architecture > have low amounts of memory and 6MB of disk storage is incredibly small Doesn't mean that performance and resource consumption is irrelevant. Virtual machines might be pretty constrained, for example. Celeron + 4GB laptops exist and people might use them. > Note that some upstreams will likely not care, and maintainers will > have to patch the scripts > manually in that case. That was the problem for Debian and derivatives when they took that initiative. Now, I think, the scripts are mostly either patched by Debian maintainers or written properly in upstreams because Debian is pretty popular distro.
Re: [arch-general] dash as default shell?
On 6/17/20 15:58, brent s. wrote: > This is false. Or at the least, grievously inaccurate. To clarify: This is less-so aimed at OP; the only issue there was a poor choice of words and explaining the suggested switch. The previous post was aimed moreso at those that do not understand there are two shells: one the system uses in scripts (usually init scripts, but more on that in a moment) vs. one the user uses, the interactive shell (the one you run commands from). /bin/sh should be fully POSIX-compatible, /bin/bash has extra features that users would find useful (such as various completion functions, etc.) dash is written to be POSIX-compliant, but no more. Now, to init- because Arch uses systemd (and, yes, now Debian and Ubuntu), one must wonder what benefit, if any, this actually serves. systemd invokes the command directly, it does not spawn a shell to run an init script like sysvinit, upstart, openrc, etc. This is, primarily, the purpose of the system shell. I don't really see much of a benefit to it being that Arch uses systemd. Granted, it probably wouldn't harm much either given the purpose of the system shell, and probably why those who have already changed it haven't seen any noticeable effects. It just seems like an unnecessary change. -- brent saner https://square-r00t.net/ GPG info: https://square-r00t.net/gpg-info signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On June 17, 2020 7:27:29 PM UTC, Piscium via arch-general wrote: >On Wed, 17 Jun 2020 at 20:19, Kusoneko wrote: > >> Pretty much this, to be honest. I don't really see the point of >changing everyone's /bin/sh for one person's personal preference when >there isn't really any point in doing so to begin with. > >The reasons Ubuntu switched in 2006 and Debian in 2011 were speed, >less bugs and more security. A simple benchmark I ran with several >shells using konsole (which is one of the fastest terminals according >to my simple benchmarks): > >time ls -R / > >• dash 8.45 >• zsh 8.53 (1 % bigger) >• bash 17.1 >• fish 19.55 > >Times are in seconds, on my desktop that has a spinning drive. The >first time it takes longer as the system caches stuff so the times >above are after running a few times. I read that in some benchmarks >dash is up to 4 times faster than bash. Sure. I personally don't really have a dog in this fight, as I don't really do shell scripting and use zsh as my login shell in most cases, and bash otherwise, but someone has to play devil's advocate and point out the cost of changing something that is this widely establish across so many distros. Of course, as most things are made with Ubuntu as a baseline because it is supposedly the most user-friendly, I'd bet the issue I pointed out isn't widespread, but it is likely still there and needs to be pointed out. signature.asc Description: PGP signature
Re: [arch-general] dash as default shell?
On 6/17/20 14:18, Piscium via arch-general wrote: (SNIP) > ... A possible issue is bashisms, however Ubuntu has > been using dash as default for 14 years and Debian also for several > years so hopefully most scripts have had bashisms removed by > upstreams. This is false. Or at the least, grievously inaccurate. Both Ubuntu and Debian use dash as the symlinked shell for /bin/sh, the default *system shell*, NOT the interactive shell for users.[0][1] Both continue to use bash as the default shell for the interactive shell (user shell). Install the latest Ubuntu and/or Debian in a VM if you don't believe me, but you'll see the same: root@ubuntutest:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:Ubuntu 20.04 LTS Release:20.04 Codename: focal root@ubuntutest:~# which $SHELL /bin/bash root@ubuntutest:~# ls -l $SHELL -rwxr-xr-x 1 root root 1183448 Feb 25 12:03 /bin/bash root@ubuntutest:~# file $SHELL /bin/bash: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a43fec47192ff49c2d3fed671f2be8df7e83784a, for GNU/Linux 3.2.0, stripped root@ubuntutest:~# echo $SHELL /bin/bash root@debian:~# lsb_release -a No LSB modules are available. Distributor ID: Debian Description:Debian GNU/Linux 10 (buster) Release:10 Codename: buster root@debian:~# which $SHELL /bin/bash root@debian:~# ls -l $SHELL -rwxr-xr-x 1 root root 1168776 Apr 18 2019 /bin/bash root@debian:~# file $SHELL /bin/bash: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=ffe165dc81a64aea2b05beda07aeda8ad71f1e7c, stripped root@debian:~# echo $SHELL /bin/bash In fact, Debian explicitly warns that dash is intended to NOT be used as the interactive shell: "It is not intended to be used interactively by a user, for example, in a terminal emulator, but rather focuses on speed and compatibility with standards. Therefore, many interactive features are not present in Dash, making it faster and more memory efficient than Bash."[1] It's faster *because they removed user features*. [0] https://wiki.ubuntu.com/DashAsBinSh [1] https://wiki.debian.org/Shell#Non-interactive_Shell -- brent saner https://square-r00t.net/ GPG info: https://square-r00t.net/gpg-info signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On June 17, 2020 7:35:27 PM UTC, Eli Schwartz via arch-general wrote: >On 6/17/20 3:18 PM, Kusoneko wrote: >> On June 17, 2020 7:06:01 PM UTC, "Jack L. Frost" >> wrote: >>> On Wed, Jun 17, 2020 at 07:18:33PM +0100, Piscium via arch-general >>> wrote: What do you think? >>> >>> I'm not sure how much utility is in doing this >> >> Pretty much this, to be honest. I don't really see the point of >> changing everyone's /bin/sh for one person's personal preference when >> there isn't really any point in doing so to begin with. > >Completely free, no cost speed improvements have no utility? Reread the >original post. > >-- >Eli Schwartz >Bug Wrangler and Trusted User It has the cost that everyone who uses scripts that use bashisms will inevitably have issues, furthermore, considering Arch only supports x86_64, I've yet to see systems under that architecture have low amounts of memory and 6MB of disk storage is incredibly small. The real question here is "Is it worth forcing people to remove bashisms or specify that the script is meant for bash in their scripts (whichever ones don't do so already) for a speed improvement on a shell scripts that work with dash?" Note that some upstreams will likely not care, and maintainers will have to patch the scripts manually in that case. signature.asc Description: PGP signature
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On 6/17/20 3:18 PM, Kusoneko wrote: > On June 17, 2020 7:06:01 PM UTC, "Jack L. Frost" > wrote: >> On Wed, Jun 17, 2020 at 07:18:33PM +0100, Piscium via arch-general >> wrote: >>> What do you think? >> >> I'm not sure how much utility is in doing this > > Pretty much this, to be honest. I don't really see the point of > changing everyone's /bin/sh for one person's personal preference when > there isn't really any point in doing so to begin with. Completely free, no cost speed improvements have no utility? Reread the original post. -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On Wed, 17 Jun 2020 at 20:19, Kusoneko wrote: > Pretty much this, to be honest. I don't really see the point of changing > everyone's /bin/sh for one person's personal preference when there isn't > really any point in doing so to begin with. The reasons Ubuntu switched in 2006 and Debian in 2011 were speed, less bugs and more security. A simple benchmark I ran with several shells using konsole (which is one of the fastest terminals according to my simple benchmarks): time ls -R / • dash 8.45 • zsh 8.53 (1 % bigger) • bash 17.1 • fish 19.55 Times are in seconds, on my desktop that has a spinning drive. The first time it takes longer as the system caches stuff so the times above are after running a few times. I read that in some benchmarks dash is up to 4 times faster than bash.
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On 6/17/20 3:05 PM, NTS wrote: > On 17 Jun 2020 8:36 p.m., "David Rosenstrauch" wrote: > > > > On 6/17/20 2:18 PM, Piscium via arch-general wrote: > >> Today I set dash as my default shell [1] on two PCs. We will see if I >> get into trouble. >> >> This question was asked years ago but maybe good to ask again. Could >> dash be made the default shell in Arch? >> > > > Couldn't you just set it as the default for your user using chsh? > > > Yes, that would probably more safe. Also, you could have a user "doot" or > whatever name with user ID 0 and shell /bin/dash to log in as a sys admin > with dash. > > Alternatively when you "su" interactively you could instead do "sudo dash". > > Used to do the same (new user with ID 0 I mean) under Solaris and it worked > flawlessly. It would be extremely safe because it wouldn't do anything, not even what the original poster wanted. It's completely unrelated to anything whatsoever. -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On Wed, 17 Jun 2020 19:18:59 +, Kusoneko wrote: > I don't really see the point of changing everyone's /bin/sh for one > person's personal preference when there isn't really any point in > doing so to begin with. See OP's first post: > I did some simple benchmarks and dash is much faster than bash, moreover > being far smaller there is less chance of bugs. -- Merlin Büge
Re: [arch-general] dash as default shell?
On June 17, 2020 7:06:01 PM UTC, "Jack L. Frost" wrote: >On Wed, Jun 17, 2020 at 07:18:33PM +0100, Piscium via arch-general >wrote: >> What do you think? > >I'm not sure how much utility is in doing this Pretty much this, to be honest. I don't really see the point of changing everyone's /bin/sh for one person's personal preference when there isn't really any point in doing so to begin with. signature.asc Description: PGP signature
Re: [arch-general] dash as default shell?
On Wed, Jun 17, 2020 at 07:18:33PM +0100, Piscium via arch-general wrote: > What do you think? I'm not sure how much utility is in doing this, but I've had my /bin/sh linked to various shells over the years, and it never ended up tripping me up, despite me tinkering with my systems constantly. The shells I've used as my /bin/sh were dash, posh, loksh (openbsd's ksh on linux) and busybox's ash. I have no specific reason for doing this, just curiosity. signature.asc Description: PGP signature
Re: [arch-general] dash as default shell?
On 17 Jun 2020 8:36 p.m., "David Rosenstrauch" wrote: On 6/17/20 2:18 PM, Piscium via arch-general wrote: > Today I set dash as my default shell [1] on two PCs. We will see if I > get into trouble. > > This question was asked years ago but maybe good to ask again. Could > dash be made the default shell in Arch? > Couldn't you just set it as the default for your user using chsh? Yes, that would probably more safe. Also, you could have a user "doot" or whatever name with user ID 0 and shell /bin/dash to log in as a sys admin with dash. Alternatively when you "su" interactively you could instead do "sudo dash". Used to do the same (new user with ID 0 I mean) under Solaris and it worked flawlessly. Best regards, NTS
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On Wed, 17 Jun 2020 at 19:39, Eli Schwartz via arch-general wrote: > > On 6/17/20 2:36 PM, David Rosenstrauch wrote: > > > > > > On 6/17/20 2:18 PM, Piscium via arch-general wrote: > >> Today I set dash as my default shell [1] on two PCs. We will see if I > >> get into trouble. > >> > >> This question was asked years ago but maybe good to ask again. Could > >> dash be made the default shell in Arch? > > > > > > Couldn't you just set it as the default for your user using chsh? > > This isn't about using it as a login shell. Describing this as "my > default shell" is a very bad description. > > This is actually about setting dash as the system /bin/sh implementation. Indeed, poor choice of words, sorry for the confusion, however in the link I provided in my original email [1] it was clear in what sense I meant it to be a default. [1] https://wiki.archlinux.org/index.php/Dash#Use_DASH_as_/bin/sh
Re: [arch-general] dash as default shell?
On Wed, 17 Jun 2020 at 20:37, David Rosenstrauch wrote: > > > On 6/17/20 2:18 PM, Piscium via arch-general wrote: > > Today I set dash as my default shell [1] on two PCs. We will see if I > > get into trouble. > > > > This question was asked years ago but maybe good to ask again. Could > > dash be made the default shell in Arch? > > > Couldn't you just set it as the default for your user using chsh? > I don't think many people will want to use dash as interactive shell. It's more about running shell scripts with a #!/bin/sh shebang. It is still possible to do that system wide of course, with a symlink in /usr/local/bin . The question whether it makes sense as default /bin/sh on Arch Linux remains valid though. I personally would be positive towards that change. -- Maarten
Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)
On 6/17/20 2:36 PM, David Rosenstrauch wrote: > > > On 6/17/20 2:18 PM, Piscium via arch-general wrote: >> Today I set dash as my default shell [1] on two PCs. We will see if I >> get into trouble. >> >> This question was asked years ago but maybe good to ask again. Could >> dash be made the default shell in Arch? > > > Couldn't you just set it as the default for your user using chsh? This isn't about using it as a login shell. Describing this as "my default shell" is a very bad description. This is actually about setting dash as the system /bin/sh implementation. -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
Re: [arch-general] dash as default shell?
On 6/17/20 2:18 PM, Piscium via arch-general wrote: Today I set dash as my default shell [1] on two PCs. We will see if I get into trouble. This question was asked years ago but maybe good to ask again. Could dash be made the default shell in Arch? Couldn't you just set it as the default for your user using chsh? DR
[arch-general] dash as default shell?
Today I set dash as my default shell [1] on two PCs. We will see if I get into trouble. This question was asked years ago but maybe good to ask again. Could dash be made the default shell in Arch? I did some simple benchmarks and dash is much faster than bash, moreover being far smaller there is less chance of bugs. A possible issue is bashisms, however Ubuntu has been using dash as default for 14 years and Debian also for several years so hopefully most scripts have had bashisms removed by upstreams. What do you think? [1] https://wiki.archlinux.org/index.php/Dash#Use_DASH_as_/bin/sh