Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 632052 - www-misc/profile-sync-daemon-5.45.1 error after install [/usr/bin/profile-sync-daemon : ligne 325: ${#DIRArr[@]##*/} : mauvaise substitution]
Summary: www-misc/profile-sync-daemon-5.45.1 error after install [/usr/bin/profile-syn...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-26 13:25 UTC by jms
Modified: 2018-12-09 11:58 UTC (History)
3 users (show)

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


Attachments
emerge --info =www-misc/profile-sync-daemon-5.45.1 (emergeInfo.txt,6.71 KB, text/plain)
2017-09-26 13:25 UTC, jms
Details
Convert "bad [map+length] substitution" to a simple length substitution (array-length-check-bash-4.4.patch,625 bytes, patch)
2018-01-18 08:19 UTC, Jyrki Launonen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jms 2017-09-26 13:25:41 UTC
Created attachment 496442 [details]
emerge --info =www-misc/profile-sync-daemon-5.45.1

Hi first install
using 5.45.1  as it the last version not using systemd

did install well but when trying to start/get status , the daemon output
 /etc/init.d/psd start                                                                                               
 * /etc/init.d/psd uses runscript, please convert to openrc-run.
 * Caching service dependencies ...                                                                                            [ ok ]
 * Starting Profile-Sync-Daemon ...
/usr/bin/profile-sync-daemon: ligne 325: ${#DIRArr[@]##*/} : mauvaise substitution                                             [ ok ]

# /etc/init.d/psd status
 * /etc/init.d/psd uses runscript, please convert to openrc-run.
/usr/bin/profile-sync-daemon: ligne 325: ${#DIRArr[@]##*/} : mauvaise substitution

also 
psd p
/usr/bin/psd: ligne 325: ${#DIRArr[@]##*/} : mauvaise substitution 
also 

for quick look here is the line 325 from /usr/bin/profile-sync-daemon
 if [[ ${#DIRArr[@]##*/} -eq $unique_count ]]; then
Comment 1 Jyrki Launonen 2018-01-18 08:19:20 UTC
Created attachment 515220 [details, diff]
Convert "bad [map+length] substitution" to a simple length substitution

This happens with bash-4.4, with bash-4.3 the issue is not present. I'd suppose 4.4 forbids that kind of "interesting" substitution.

If I understand the code around that line 325 correctly, they are checking whether DIRArr length is same as the count of unique items of an array mapped from DIRArr containing only the last path parts of DIRArr elements. I guess the line 325 substitution tries to find out length of the array created with last path parts. Now, the both arrays should be same length if that length+map -substitution does nothing magic, thus the whole `map`-operation before taking array `length` should be useless.

Attached patch converts the map+length -check to simple length-check, and thus far seems to work just fine. Should work on bash-4.3 too.

# mkdir -p /etc/portage/patches/www-misc/profile-sync-daemon-5.45.1

Then copy the attached patch to that directory, and

# emerge --oneshot =profile-sync-daemon-5.45.1

Ensure no browsers are running, and then

# /etc/init.d/psd start
(but that might complain that psd is already started -> check status ensuring that profile-sync-daemon itself says the daemon pid file is not present and zap if needed.)
Comment 2 Pacho Ramos gentoo-dev 2018-06-20 15:37:01 UTC
please retry with 6.31
Comment 3 Jyrki Launonen 2018-06-29 16:17:29 UTC
(In reply to Pacho Ramos from comment #2)
> please retry with 6.31

Given the constraint that this must operate on OpenRC i.e. without systemd, 6.31 is not a viable option as it requires systemd to be present unconditionally:

https://gitweb.gentoo.org/repo/gentoo.git/tree/www-misc/profile-sync-daemon/profile-sync-daemon-6.31.ebuild#n21

and further detailed few lines after:

https://gitweb.gentoo.org/repo/gentoo.git/tree/www-misc/profile-sync-daemon/profile-sync-daemon-6.31.ebuild#n27