Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
Date: Thu, 06 Sep 2018 08:22:29
Message-Id: 6628530.VkcCMiNJZq@dell_xps
In Reply to: Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot by Samuraiii
1 Thanks Samuraiii,
2
3 On Thursday, 6 September 2018 08:48:31 BST Samuraiii wrote:
4 > On 5.9.2018 21:20, Mick wrote:
5
6 > > I just noticed a psd error at boot time:
7 > >
8 > > /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad
9 > > substitution
10 > >
11 > > Any idea what's brought this about?
12 >
13 > Hi,
14 >
15 > my bet is that your /bin/sh != /bin/bash and
16
17 $ echo $SHELL
18 /bin/bash
19
20 $ ls -la /bin/sh
21 lrwxrwxrwx 1 root root 4 Jan 5 2018 /bin/sh -> bash
22
23 > /usr/bin/profile-sync-daemon starts with #!/bin/sh.
24
25 No, it starts with the bash shebang:
26
27 #!/bin/bash
28
29 #
30 # Profile-sync-deamon by graysky <graysky AT archlinux DOT us>
31 # Inspired by some code originally written by Colin Verot
32 #
33
34
35 > The other way around /usr/bin/profile-sync-daemon contains bashishms.
36 >
37 > You can try (as a test) to change #!/bin/sh for #!/bin/bash...
38 >
39 > S
40
41 It's soooo full of bashisms I wouldn't know where to start. The substitution
42 line with the error is shown below, but my regex-fu is not good enough to
43 troubleshoot it:
44
45 # browser is on system so check profiles
46 #
47 # check that the LAST DIRECTORY in the full path is unique
48 unique_count=$(echo ${DIRArr[@]##*/} | sed 's/ /\n/g' | sort | uniq | wc -l)
49 if [[ ${#DIRArr[@]##*/} -eq $unique_count ]]; then
50 return # no problems so do nothing
51 else
52 echo -e " ${RED}Error: ${NRM}${BLD}dup profile for ${GRN}$browser${NRM}$
53 {BLD} detected. See psd manpage, correct, and try again."${NRM}
54
55
56 I also noticed the startup script has not yet been converted to openrc-run:
57
58 # /etc/init.d/psd restart
59 * /etc/init.d/psd uses runscript, please convert to openrc-run.
60 * Starting Profile-Sync-Daemon ...
61 /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution [
62 ok ]
63
64 --
65 Regards,
66 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature