Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-18 Thread Eli Schwartz via arch-general
On 6/18/20 7:15 PM, Chris Billington via arch-general wrote:
> I haven't seen this mentioned yet which makes me wonder if I've
> misunderstood, but isn't it already the case that bash runs in a
> posix-compatible mode if executed as /bin/sh?
> 
> I remember a bug a while back [1] that broke graphical login because
> flatpak used a bashism in an X startup script. Does this not imply that any
> bashisms executed with /bin/sh would already be causing breakage today on
> Arch Linux?
> 
> [1] https://bugs.archlinux.org/task/61420#comment176360

Yep -- as I said earlier in the thread:

> Meanwhile, scripts which use bashisms but a /bin/sh shebang are broken
> even if /bin/sh is a symlink to bash. Bash disables some, but not all,
> features of bash if it is invoked in POSIX mode, such as via a symlink
> named /bin/sh -- so, you do not even get the benefits of bash, and never
> have, if you used /bin/sh as your shebang.

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-18 Thread Chris Billington via arch-general
I haven't seen this mentioned yet which makes me wonder if I've
misunderstood, but isn't it already the case that bash runs in a
posix-compatible mode if executed as /bin/sh?

I remember a bug a while back [1] that broke graphical login because
flatpak used a bashism in an X startup script. Does this not imply that any
bashisms executed with /bin/sh would already be causing breakage today on
Arch Linux?

[1] https://bugs.archlinux.org/task/61420#comment176360


Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-18 Thread Bardur Arantsson
On 19/06/2020 00.18, Eli Schwartz via arch-general wrote:
> 
> I've provided rationale why I don't believe it will break much, you
> *agree* with me, and yet you say my arguments don't hold water?
> 

Heh, I'm too tired to get into a detailed debate, but it's very possible
to be right for the wrong reasons! :)

Regards,


Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-18 Thread Eli Schwartz via arch-general
On 6/18/20 6:06 PM, Bardur Arantsson wrote:
> On 18/06/2020 18.22, Eli Schwartz via arch-general wrote:
>>> And nearly everybody who has to write this quickly will do it wrong.
>>
>> And yet, some do not. Some write elegant, simple POSIX sh scripts which
>> do it right. For example, people often forget that pipelines and
>> functions are an option, and sometimes a much faster and better option
>> than global state variables.
>>
>> And most people who are writing /bin/bash scripts are *also* doing it
>> wrong because they don't really know what they are doing. Just saying. :p
>>
> 
> This is an argument from the Perfect/Robot programmer and is utterly false.
> 
> We should just collectively face the truth that shell is not a good way
> to program anything non-trivial. :D

I... don't see what you're arguing against?

Someone made an argument that security would be aided by using a larger
shell which has more features that can avoid some of the gross hacks
people sometimes do in POSIX sh.

I argued in response that most people suck at writing bash *anyway*, and
it's possible for people who know what they're doing to write perfectly
safe POSIX sh.

It's immaterial to the discussion either way, but I just figured I would
point out that anyone who I'd actually trust to write shell scripts, I'd
usually trust to write POSIX shell scripts too. So there's no need to
make some arbitrary divide where bash is "safer" than POSIX sh and the
latter should never be used.

Your response is... I'm wrong because only the Perfect/Robot programmer
can write good shell of any kind, and people shouldn't program in shell?
Where did I say people should program in shell?

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-18 Thread Eli Schwartz via arch-general
On 6/18/20 6:00 PM, Bardur Arantsson wrote:
> On 18/06/2020 06.33, Eli Schwartz via arch-general wrote:
>> You pulled this assertion out of thin air, do you have any proof that it
>> "breaks more than a decade of setups"?
> 
> OP is the one making an assertion, so the burden of proof is on them.
> 
> That said... I suspect most the system-wide breakage that would have
> been expected would be due to init scripts and systemd ameliorates that
> to a large degree.

The OP is sharing an assertion made by many people, that /bin/sh as dash
is safe. As I've mentioned previously in the thread, there is a lot of
prior art. Anything that is expected to work on multiple distros,
generally should work.

SysV init scripts might not work, if they were Arch-specific. Yes. That
is of course no longer a concern, and the primary concern is instead
system scripts, applications, frameworks, etc. which run after boot, not
as part of boot.

>> 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.
>>
> 
> Inherent flaws in a setup doesn't mean that shit doesn't break. Ideally,
> yes, there would be no flaws, but this is the real world.
> 
> Doubtless, we all try to strive towards perfection, but there is no such
> thing in practice.

That is completely beside the point. If it doesn't work on Debian,
chances are someone is going to notice and fix it. :p

The world is no longer a place where everyone assumes /bin/sh works like
bash.

Following in the footsteps of Debian in this regard is not some super
dangerous endeavor.

>> 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/
>>
> 
> In practice, I agree that it probably won't break much, but your
> arguments largely don't hold water.

I've provided rationale why I don't believe it will break much, you
*agree* with me, and yet you say my arguments don't hold water?

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [arch-general] dash as system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Eli Schwartz via arch-general
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 system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Shorrer via arch-general
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 system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Kusoneko
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?)

2020-06-17 Thread Eli Schwartz via arch-general
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 system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Eli Schwartz via arch-general
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 system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Piscium via arch-general
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 system /bin/sh? (Was: dash as default shell?)

2020-06-17 Thread Eli Schwartz via arch-general
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