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

Bug 609146

Summary: app-emulation/lxd: lxd-*.initd are not POSIX compliant
Product: Gentoo Linux Reporter: Andrew Savchenko <bircoph>
Component: Current packagesAssignee: Erik Mackdanz <stasibear>
Severity: normal CC: zmedico
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 609070    
Attachments: lxd.init.patch

Description Andrew Savchenko gentoo-dev 2017-02-12 17:20:37 UTC
Created attachment 463480 [details, diff]


init scripts should be POSIX compatible, see bug 609070.

However lxd init scripts are not: they use [[ ]] instead of [ ].

Proposed patch fixes this. It is quite simple, so I'll apply in two weeks if there are no objections.
Comment 1 Erik Mackdanz gentoo-dev 2017-03-20 04:46:26 UTC
I changed this for the latest 2.11 and subsequent versions.  I did not change existing versions, but they will fall off over time.
Comment 2 Jeff Kowalczyk 2017-03-23 22:13:39 UTC
With the current lxd-2.11.initd, I see the following message on service start:

$ sudo /etc/init.d/lxd restart                                                                                                    
/etc/init.d/lxd: line 30: [: =: unary operator expected
/etc/init.d/lxd: line 30: [: =: unary operator expected

Current line 30 is:

    if [ $RC_GOINGDOWN = YES ] || [ $RC_REBOOT = YES ]; then
Comment 3 Jeff Kowalczyk 2017-03-23 22:34:38 UTC
Changing line 30 to quote the arguments of the equality comparison avoids the warning:

    if [ "$RC_GOINGDOWN" = "YES" ] || [ "$RC_REBOOT" = "YES" ]; then

I haven't stepped through to check the conditions where one of the $RC_ are true, but if they are blank, as in the case of a service restart, I think the test fails.
Comment 4 Andrew Savchenko gentoo-dev 2017-03-23 23:48:38 UTC
Yes, double quotes are mandatory and are present in the original patch.
Erik, please fix this.
Comment 5 Zac Medico gentoo-dev 2017-06-08 08:46:48 UTC
(In reply to Andrew Savchenko from comment #4)
> Yes, double quotes are mandatory and are present in the original patch.
> Erik, please fix this.

I've included then in the lxd-2.14 version bump: