Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 408117

Summary: sys-fs/cryptsetup-1.4.1: bashism in /etc/init.d/dmcrypt
Product: Gentoo Linux Reporter: Maxim Kammerer <mk>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: f_philipp
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 401217    

Description Maxim Kammerer 2012-03-14 05:27:46 UTC
With dash as /bin/sh:

# rc-update -u
 * Caching service dependencies ...
/etc/init.d/dmcrypt: 150: Syntax error: Bad for loop variable                                            [ ok ]

This error is displayed on every boot, even when dmcrypt is not in one of the runlevels. Not sure if it causes issues beyond that.

Suggest replacing
            for (( i = 0 ; i < 3 ; i += 1 )) ; do
with
            for i in 0 1 2 ; do
Comment 1 Maxim Kammerer 2012-03-28 01:46:53 UTC
Hi, any comment? This affects all users who use dash for /bin/sh, not just those who have dmcrypt in one of the runlevels. This is also not an upstream issue -- the problem is in /usr/portage/sys-fs/cryptsetup/files/dmcrypt.rc. The fix is trivial.
Comment 2 Florian Philipp 2012-05-02 15:29:00 UTC
It is worth noting that this might now hit stable users of app-admin/eselect-sh
Comment 3 Outer Measure 2012-05-05 10:29:25 UTC
One doesn't need app-admin/eselect-sh to change the default shell to dash (or any other shell).  Admittedly, very few people change the system default shell by hand.
Comment 4 Florian Philipp 2012-05-05 10:34:21 UTC
(In reply to comment #3)
> One doesn't need app-admin/eselect-sh to change the default shell to dash
> (or any other shell).  Admittedly, very few people change the system default
> shell by hand.

Agreed. But before the introduction of eselect-sh, changing /bin/sh basically circumvented the package manager and baselayout, meaning that "if you break it, you keep the parts" applied. Now it is more or less officially supported to substitute bash with dash.

I think, at least a warning when emerging dmcrypt or eselect-sh is in order. Admittedly, removing the bashism is less work ;)
Comment 5 SpanKY gentoo-dev 2012-05-11 08:18:21 UTC
should be all set now in the tree; thanks for the report!

Commit message: Use POSIX compliant for loop
http://sources.gentoo.org/sys-fs/cryptsetup/files/dmcrypt.rc?r1=1.2&r2=1.3