You are not logged in.
Pages: 1
Since dash is now in the core repo, why is '/bin/sh -> bash' not removed from the bash package, and a '/bin/sh -> dash' moved into the dash package?
From what i got after some searching, there's no particular issues [left] with default Arch/Pacman scripts using #!/bin/sh while making use of bashisms, but do you think it's still risky to use dash as /bin/sh?
Last edited by TaylanUB (2010-03-15 18:14:07)
``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein
Offline
Because the initscripts are not compatible with dash. This has been discussed in depth many times.
![]()
Offline
Because the initscripts are not compatible with dash. This has been discussed in depth many times.
But like TaylanUB said, the initscripts all call /bin/bash now. None of them use /bin/sh.
Offline
You lost me. You are asking why dash can't replace bash in the Arch initscripts? My understanding was that they only work with bash.
Has this changed?
![]()
Offline
Nope, that's all correct. But you've misunderstood the question. Right now /bin/sh is a symlink to /bin/bash, and is provided in the bash package. The question is whether /bin/sh should be a symlink to /bin/dash instead, provided in the dash package. This shouldn't be a problem with any of the Arch scripts, because as far as I know, they all run as bash anyway, not sh.
I've tried doing it manually in the past but always ran into problems with pacman/makepkg. I tried it again just now and had trouble with X for some reason.
Last edited by fflarex (2010-03-14 23:35:44)
Offline
Many of the Arch package .install scripts assume /bin/sh is bash...
Edit: makepkg uses /bin/bash so is not affected.
Offline
Nope, that's all correct. But you've misunderstood the question. Right now /bin/sh is a symlink to /bin/bash, and is provided in the bash package. The question is whether /bin/sh should be a symlink to /bin/dash instead, provided in the dash package. This shouldn't be a problem with any of the Arch scripts, because as far as I know, they all run as bash anyway, not sh.
I've tried doing it manually in the past but always ran into problems with pacman/makepkg. I tried it again just now and had trouble with X for some reason.
Oh now I see what you mean. Sorry, it is a hazy Monday morning here ![]()
I suppose it won't be much of a problem then but developers just need to know in the future that they will be using dash when specifying sh, otherwise will need to explicitly use bash. What it comes down to is, is it worth it? Plus what Allan just said. Not to mention many AUR packages they could possibly break also.
Last edited by sand_man (2010-03-15 00:56:00)
![]()
Offline
@fflarex/Allan: Thanks for warning. Better not touch it then. People shouldn't be so careless about this issue though, IMO. (Just explicitly use #!/bin/bash; everything solved.)
@sand_man: When developers specify /bin/sh, they use /bin/sh (Bourne shell), and [d]ash is Bourne (and POSIX) compatible (and no more). The standard /bin/sh of other Unixen might not have non-standard features introduced by Bash, but they all must be at least POSIX/Bourne compatible, so when you use #!/bin/sh, it means your script is portable; if it isn't, don't mark it so... (Sadly, people do.)
Linking /bin/sh to dash makes sense because dash is more minimal (and thus fast); just enough for a script that claims Bourne shell compatibility. If you write a script using features specific to Bash, it should have #!/bin/bash anyway, so linking /bin/sh to dash is supposed not to break anything.
``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein
Offline
@fflarex/Allan: Thanks for warning. Better not touch it then. People shouldn't be so careless about this issue though, IMO. (Just explicitly use #!/bin/bash; everything solved.)
Or people should accept that in Arch /bin/sh is bash.
Offline
i'm pro using /bin/bash if you want bash features, /bin/sh if you want to use posix sh, and symlinking sh to dash as it's more lightweight.
although it looks like dash is not 100% posix sh compliant right now. see http://en.wikipedia.org/wiki/Debian_Almquist_shell
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Do you think there's any chance that the dash in core will get a LINENO patch? (There are some (at least one i've seen) floating around.)
Or people should accept that in Arch /bin/sh is bash.
Isn't that forcing something non-standard onto the users?
Every *nix has a /bin/sh, and POSIX is the only reliable standard. If i mark my script #!/bin/sh, every standards-compliant /bin/sh should be able to run it, independent from the OS in use.
If you'll criticize POSIX or something like that, then it's another story; but even then, there's absolutely no reason not to just use #!/bin/bash if you use features found in Bash and not Bourne/Korn/[d]ash ... other than saving 16 bits per script, of course. =P
``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein
Offline
I try to mark my scripts as #!/bin/bash where they use bash features, and in an ideal world everyone else would do the same. However, we don't live in an ideal world and the unfortunate fact is that there are many shell scripts in use on Arch today where #!/bin/sh is used when it should refer to bash instead. Rather than spending ages messing about and causing all kinds of upheaval for some pointlessly minuscule speed gains, it is much simpler just to accept that this is the way things are and just move on.
Only my opinion, of course.
Offline
Well, things can get fixed over time. It's enough for someone who comes to hear about this issue to pay care for the _next_ time; all they need to do is to type 'bash' instead of 'sh', if they're unsure.
Remind you that i opened the thread just to ask about this. Now i've learned it's unsafe to link /bin/sh to dash, and i'm not asking anyone to 'fix' something. (But i guess there's been a lot of debates before...)
Edit: Marked "solved" since the original question has been answered; better DON'T link /bin/sh to dash.
Last edited by TaylanUB (2010-03-15 18:15:13)
``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein
Offline
@fflarex/Allan: Thanks for warning. Better not touch it then. People shouldn't be so careless about this issue though, IMO. (Just explicitly use #!/bin/bash; everything solved.)
@sand_man: When developers specify /bin/sh, they use /bin/sh (Bourne shell), and [d]ash is Bourne (and POSIX) compatible (and no more). The standard /bin/sh of other Unixen might not have non-standard features introduced by Bash, but they all must be at least POSIX/Bourne compatible, so when you use #!/bin/sh, it means your script is portable; if it isn't, don't mark it so... (Sadly, people do.)
Linking /bin/sh to dash makes sense because dash is more minimal (and thus fast); just enough for a script that claims Bourne shell compatibility. If you write a script using features specific to Bash, it should have #!/bin/bash anyway, so linking /bin/sh to dash is supposed not to break anything.
Thanks for enlightening me.
![]()
Offline
Pages: 1