Opened 7 years ago

Closed 7 years ago

#159 closed defect (fixed)

dash appears to mangle variable expansion in RPM scriptlets, etc.

Reported by: Lewis Rosenthal Owned by:
Priority: major Milestone:
Component: dash Version:
Severity: high Keywords:
Cc:

Description

Installing libodin with dash as default shell creates junk entries in ODIN.INI, rendering (for example) Java half-broken:

[DEVDIRECTORIES]
WINDOWS=M:^Kar\lib\odin


[ODINSYSTEM]
PE_EXE=M:\usin\PE.EXE
PEC_EXE=M:\usin\PEC.EXE
W16ODIN_EXE=M:\usin\W16ODIN.EXE

This junk handling is also propagated to the Odin32 registry entries.

Apparently, bash handles these things properly, as does ash. However, shifting from dash to ash as the default shell is not very easy.

Change History (5)

comment:1 Changed 7 years ago by Silvan Scherrer

shifting from dash to ash as default shell is very easy. a file edit and a file copy :)
but of course not recommended, as the other shell has other issues.

and most probably it's not a shell issue, but a spec file issue. We will look at it soon.

comment:2 Changed 7 years ago by dmik

This is a known problem and it doesn't relate to dash per se — but instead to the way how the buillt-in echo command is implemented in different POSIX shells. There is no single standard and some do escaped character expansion by default (dash, zsh), some don't (bash, ash). Escaped characters are \n, '\b', \t and alike. Things get worse given that the shell itself interprets escaped chars differently depending on the quotes (single or double). A rule of thumb here is NOT use echo for sensitive output like this. You should either use printf (sometimes built-in as in case of dash) or expr (usually external). Run this script under dash, ash and bash to see the difference. In short, echo under dash behaves like printf but under bash and ash — like expr.

echo "usr\\bin"
echo 'usr\\bin'
expr "usr\\bin"
expr 'usr\\bin'
printf "usr\\bin\n"
printf 'usr\\bin\n'

I didn't know all this when I first did odin.spec 6 years ago :) It just needs fixing (change echo to printf and use single quotes). Will do that in the mean time.

BTW it used to be possible to restore ash as the default shell with a couple of simple yum commands (there are dash-sh and ash-sh packages responsible for which shell is the default one) but it no longer works due to broken dependencies. I need to look at that too.

comment:3 Changed 7 years ago by Lewis Rosenthal

Yes, I discovered that even with yum replace, I could not get the replacement made, and instead had to use a kludge (manually copy ash.exe to sh.exe) to get it done, but as stated, there are known limitations of ash, as well, and this is not a good solution.

A fixed/updated spec for libodin would be appreciated, as it is now terribly broken in ArcaOS with initial install (which in turn breaks some Java 1.6 dependencies), so as we say, this stuff all rolls downhill (LOL).

So, if you feel that this is not a bug but a condition of the shell, then we should close this, as there's nothing to do (except change the spec and any other scripts similarly affected).

comment:4 Changed 7 years ago by Silvan Scherrer

yes we will close it, but not before we changed the spec. as you know we all get some days older sometimes and tend to forget stuff. and sometimes after some nights you even get older several days :)

comment:5 Changed 7 years ago by dmik

Resolution: fixed
Status: newclosed

With the release of odin 0.9.0 RPM which is now in exp, the problem no longer exists (I used cat to create the INI file instead of echo or expr or printf btw — and it doesn't do any special escape processing of course). Closing this. Please test and feel free to reopen if it's still broken for you.

Note: See TracTickets for help on using tickets.