Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 451460 - sys-fs/cryptsetup - bashisms in /etc/init.d/dmcrypt
Summary: sys-fs/cryptsetup - bashisms in /etc/init.d/dmcrypt
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Keywords: PATCH
: 484728 523864 (view as bug list)
Depends on:
Reported: 2013-01-11 21:16 UTC by Alexander Tsoy
Modified: 2015-04-12 20:03 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---

dmcrypt-posix.patch (dmcrypt-posix.patch,1004 bytes, patch)
2013-03-21 16:24 UTC, Khayyam
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Tsoy 2013-01-11 21:16:07 UTC
Please remove bashisms from dmcrypt initscript. ${key/*:/} is probably equivalent to ${key##*:}. "type" is an XSI POSIX extension, but probably could be replaced by "command -v". And I'm not sure how to deal with "read -u".

 * QA Notice: shell script appears to use non-POSIX feature(s):
 *    possible bashism in /etc/init.d/dmcrypt line 99 (${parm/?/pat[/str]}):
 *              mode=${key/*:/} && ( [ "${mode}" = "${key}" ] || [ -z "${mode}" ] ) && mode=reg
 *    possible bashism in /etc/init.d/dmcrypt line 100 (${parm/?/pat[/str]}):
 *              key=${key/:*/}
 *    possible bashism in /etc/init.d/dmcrypt line 158 (type):
 *              if type -p gpg >/dev/null ; then
 *    possible bashism in /etc/init.d/dmcrypt line 258 (read with option other than -r):
 *      while read -u 3 targetline ; do

Reproducible: Always
Comment 1 Khayyam 2013-03-21 16:24:34 UTC
Created attachment 342852 [details, diff]
Comment 2 Khayyam 2013-03-21 16:26:06 UTC
(In reply to comment #0)

> And I'm not sure how to deal with "read -u"

You would use something like "while read <&3 targetline ; do". I have made changes suggested by you/checkbashisms (see attached patch) but for whatever reason both /bin/dash and /bin/bb still balk ... though with the same changes /bin/bash has no issues whatsoever (go figure). The only other reason I can see is 'local' but both dash and bb have this as a builtin (though its possible they handle it differently).

It would be nice to have either bb or dash as /bin/sh but currently I'm too busy to fiddle with it.

best ... khay
Comment 3 SpanKY gentoo-dev 2013-09-14 03:33:24 UTC
*** Bug 484728 has been marked as a duplicate of this bug. ***
Comment 4 Alexander Hof 2014-01-17 12:04:04 UTC
(In reply to Khayyam from comment #2)

> but for whatever
> reason both /bin/dash and /bin/bb still balk ...

Your patch is working fine with mksh. Thanks!
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2014-09-27 10:52:41 UTC
*** Bug 523864 has been marked as a duplicate of this bug. ***
Comment 6 Mark 2014-09-27 11:03:22 UTC
I confirm that the patch works also for dash.
Comment 7 cazzantonio 2015-03-10 09:37:49 UTC
works for me too, with app-shells/dash-
Comment 8 SpanKY gentoo-dev 2015-04-12 20:03:58 UTC
should be all set now in the tree; thanks for the report!

Commit message: Fix bashisms in init script