* [gentoo-user] profile-sync-daemon "bad substitution" at boot
@ 2018-09-05 19:20 Mick
2018-09-06 7:48 ` Samuraiii
0 siblings, 1 reply; 6+ messages in thread
From: Mick @ 2018-09-05 19:20 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
Hi All,
I just noticed a psd error at boot time:
/usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution
Any idea what's brought this about?
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
2018-09-05 19:20 [gentoo-user] profile-sync-daemon "bad substitution" at boot Mick
@ 2018-09-06 7:48 ` Samuraiii
2018-09-06 8:18 ` Alexander Kapshuk
2018-09-06 8:22 ` Mick
0 siblings, 2 replies; 6+ messages in thread
From: Samuraiii @ 2018-09-06 7:48 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1.1.1: Type: text/plain, Size: 469 bytes --]
On 5.9.2018 21:20, Mick wrote:
> Hi All,
>
> I just noticed a psd error at boot time:
>
> /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution
>
> Any idea what's brought this about?
>
Hi,
my bet is that your /bin/sh != /bin/bash and
/usr/bin/profile-sync-daemon starts with #!/bin/sh.
The other way around /usr/bin/profile-sync-daemon contains bashishms.
You can try (as a test) to change #!/bin/sh for #!/bin/bash...
S
[-- Attachment #1.1.2: Type: text/html, Size: 1012 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
2018-09-06 7:48 ` Samuraiii
@ 2018-09-06 8:18 ` Alexander Kapshuk
2018-09-06 8:22 ` Alexander Kapshuk
2018-09-06 8:22 ` Mick
1 sibling, 1 reply; 6+ messages in thread
From: Alexander Kapshuk @ 2018-09-06 8:18 UTC (permalink / raw
To: Gentoo mailing list
On Thu, Sep 6, 2018 at 10:48 AM Samuraiii <samurai.no.dojo@gmail.com> wrote:
>
> On 5.9.2018 21:20, Mick wrote:
>
> Hi All,
>
> I just noticed a psd error at boot time:
>
> /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution
>
> Any idea what's brought this about?
>
> Hi,
>
> my bet is that your /bin/sh != /bin/bash and /usr/bin/profile-sync-daemon starts with #!/bin/sh.
>
> The other way around /usr/bin/profile-sync-daemon contains bashishms.
>
> You can try (as a test) to change #!/bin/sh for #!/bin/bash...
>
> S
The shebang in the master repository is '#!/bin/bash'.
https://raw.githubusercontent.com/graysky2/profile-sync-daemon/master/common/profile-sync-daemon.in
The error message is a shell parameter expansion syntax error, which
comprises two different expansion constructs referenced below.
${#parameter}
String Length.
${parameter##[word]}
Remove Largest Prefix Pattern.
See section 2.6.2 Parameter Expansion,
http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html.
The script in the master repository referenced above does not contain
the line in question. It has '${#DIRArr[@]/}' and '${DIRArr[@]##*/}'.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
2018-09-06 8:18 ` Alexander Kapshuk
@ 2018-09-06 8:22 ` Alexander Kapshuk
2018-09-06 8:27 ` Mick
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kapshuk @ 2018-09-06 8:22 UTC (permalink / raw
To: Gentoo mailing list
On Thu, Sep 6, 2018 at 11:18 AM Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
>
> On Thu, Sep 6, 2018 at 10:48 AM Samuraiii <samurai.no.dojo@gmail.com> wrote:
> >
> > On 5.9.2018 21:20, Mick wrote:
> >
> > Hi All,
> >
> > I just noticed a psd error at boot time:
> >
> > /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution
> >
> > Any idea what's brought this about?
> >
> > Hi,
> >
> > my bet is that your /bin/sh != /bin/bash and /usr/bin/profile-sync-daemon starts with #!/bin/sh.
> >
> > The other way around /usr/bin/profile-sync-daemon contains bashishms.
> >
> > You can try (as a test) to change #!/bin/sh for #!/bin/bash...
> >
> > S
>
> The shebang in the master repository is '#!/bin/bash'.
> https://raw.githubusercontent.com/graysky2/profile-sync-daemon/master/common/profile-sync-daemon.in
>
> The error message is a shell parameter expansion syntax error, which
> comprises two different expansion constructs referenced below.
> ${#parameter}
> String Length.
>
> ${parameter##[word]}
> Remove Largest Prefix Pattern.
>
> See section 2.6.2 Parameter Expansion,
> http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html.
>
> The script in the master repository referenced above does not contain
> the line in question. It has '${#DIRArr[@]/}' and '${DIRArr[@]##*/}'.
This appears to have been reported as a bug in Debian [1]
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839049
And applied upstream [2].
https://github.com/graysky2/profile-sync-daemon/pull/185/files/654f5359abfe7aab2e1616dd74c8ba0f76ce4ab4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
2018-09-06 8:22 ` Alexander Kapshuk
@ 2018-09-06 8:27 ` Mick
0 siblings, 0 replies; 6+ messages in thread
From: Mick @ 2018-09-06 8:27 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]
On Thursday, 6 September 2018 09:22:35 BST Alexander Kapshuk wrote:
> On Thu, Sep 6, 2018 at 11:18 AM Alexander Kapshuk
>
> <alexander.kapshuk@gmail.com> wrote:
> > On Thu, Sep 6, 2018 at 10:48 AM Samuraiii <samurai.no.dojo@gmail.com>
wrote:
> > > On 5.9.2018 21:20, Mick wrote:
> > >
> > > Hi All,
> > >
> > > I just noticed a psd error at boot time:
> > >
> > > /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad
> > > substitution
> > >
> > > Any idea what's brought this about?
> > >
> > > Hi,
> > >
> > > my bet is that your /bin/sh != /bin/bash and
> > > /usr/bin/profile-sync-daemon starts with #!/bin/sh.
> > >
> > > The other way around /usr/bin/profile-sync-daemon contains bashishms.
> > >
> > > You can try (as a test) to change #!/bin/sh for #!/bin/bash...
> > >
> > > S
> >
> > The shebang in the master repository is '#!/bin/bash'.
> > https://raw.githubusercontent.com/graysky2/profile-sync-daemon/master/comm
> > on/profile-sync-daemon.in
> >
> > The error message is a shell parameter expansion syntax error, which
> > comprises two different expansion constructs referenced below.
> > ${#parameter}
> > String Length.
> >
> > ${parameter##[word]}
> > Remove Largest Prefix Pattern.
> >
> > See section 2.6.2 Parameter Expansion,
> > http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html.
> >
> > The script in the master repository referenced above does not contain
> > the line in question. It has '${#DIRArr[@]/}' and '${DIRArr[@]##*/}'.
>
> This appears to have been reported as a bug in Debian [1]
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839049
> And applied upstream [2].
> https://github.com/graysky2/profile-sync-daemon/pull/185/files/654f5359abfe7
> aab2e1616dd74c8ba0f76ce4ab4
Thanks Alexander, good catch!
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] profile-sync-daemon "bad substitution" at boot
2018-09-06 7:48 ` Samuraiii
2018-09-06 8:18 ` Alexander Kapshuk
@ 2018-09-06 8:22 ` Mick
1 sibling, 0 replies; 6+ messages in thread
From: Mick @ 2018-09-06 8:22 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
Thanks Samuraiii,
On Thursday, 6 September 2018 08:48:31 BST Samuraiii wrote:
> On 5.9.2018 21:20, Mick wrote:
> > I just noticed a psd error at boot time:
> >
> > /usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad
> > substitution
> >
> > Any idea what's brought this about?
>
> Hi,
>
> my bet is that your /bin/sh != /bin/bash and
$ echo $SHELL
/bin/bash
$ ls -la /bin/sh
lrwxrwxrwx 1 root root 4 Jan 5 2018 /bin/sh -> bash
> /usr/bin/profile-sync-daemon starts with #!/bin/sh.
No, it starts with the bash shebang:
#!/bin/bash
#
# Profile-sync-deamon by graysky <graysky AT archlinux DOT us>
# Inspired by some code originally written by Colin Verot
#
> The other way around /usr/bin/profile-sync-daemon contains bashishms.
>
> You can try (as a test) to change #!/bin/sh for #!/bin/bash...
>
> S
It's soooo full of bashisms I wouldn't know where to start. The substitution
line with the error is shown below, but my regex-fu is not good enough to
troubleshoot it:
# browser is on system so check profiles
#
# check that the LAST DIRECTORY in the full path is unique
unique_count=$(echo ${DIRArr[@]##*/} | sed 's/ /\n/g' | sort | uniq | wc -l)
if [[ ${#DIRArr[@]##*/} -eq $unique_count ]]; then
return # no problems so do nothing
else
echo -e " ${RED}Error: ${NRM}${BLD}dup profile for ${GRN}$browser${NRM}$
{BLD} detected. See psd manpage, correct, and try again."${NRM}
I also noticed the startup script has not yet been converted to openrc-run:
# /etc/init.d/psd restart
* /etc/init.d/psd uses runscript, please convert to openrc-run.
* Starting Profile-Sync-Daemon ...
/usr/bin/profile-sync-daemon: line 325: ${#DIRArr[@]##*/}: bad substitution [
ok ]
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-06 8:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-05 19:20 [gentoo-user] profile-sync-daemon "bad substitution" at boot Mick
2018-09-06 7:48 ` Samuraiii
2018-09-06 8:18 ` Alexander Kapshuk
2018-09-06 8:22 ` Alexander Kapshuk
2018-09-06 8:27 ` Mick
2018-09-06 8:22 ` Mick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox