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

Bug 632052

Summary: www-misc/profile-sync-daemon-5.45.1 error after install [/usr/bin/profile-sync-daemon : ligne 325: ${#DIRArr[@]##*/} : mauvaise substitution]
Product: Gentoo Linux Reporter: jms <jms.gentoo>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED TEST-REQUEST    
Severity: normal CC: agentp2, codez_iccd_99, rem11_1999
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info =www-misc/profile-sync-daemon-5.45.1
Convert "bad [map+length] substitution" to a simple length substitution

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