Skip to content

Added use of PERL5LIB in SYSV script and in systemd unit file.#24

Merged
mherger merged 1 commit intoLMS-Community:public/8.2from
JohanSaaw:public/8.2
Apr 12, 2021
Merged

Added use of PERL5LIB in SYSV script and in systemd unit file.#24
mherger merged 1 commit intoLMS-Community:public/8.2from
JohanSaaw:public/8.2

Conversation

@JohanSaaw
Copy link
Copy Markdown
Contributor

By setting PERL5LIB in the SYSV init script and in the systemd unit file we will work around the different values of the perl @inc array in the different distributions. With PERL5LIB set to /usr/lib/perl5/vendor_perl, the squeezebox server executable will search for modules in that directory before it searches any of the directories in the @inc array.

As result it is no longer needed to create a symbolic link pointing to /usr/lib/perl5/vendor_perl from a directory present in @inc on any of the RPM based distributions.

Copy link
Copy Markdown
Member

@michaelherger michaelherger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the more generic approach instead of hacking for specific systems.

Please see my comments about adding vs. replacing the library path.

# package drops the Slim perl modules. Setting PERL5LIB to this location will
# make sure that the squeezebox server executable looks here before it scans the
# directories in the perl @INC array.
export PERL5LIB="/usr/lib/perl5/vendor_perl"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you add this path to PERL5LIB, rather than replace it completely? The user could potentially have it set for good reasons.

# package drops the Slim perl modules. Setting PERL5LIB to this location will
# make sure that the squeezebox server executable looks here before it scans the
# directories in the perl @INC array.
Environment="PERL5LIB=/usr/lib/perl5/vendor_perl"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I actually did think about this too. The setting of this variable the way I have done will only have an impact for the process running squeezeboxserver, it will not change the value globally. But even so, it will of course have an impact if someone have set PERL5LIB with the direct intent to add or change something to the squeezeboxserver process

It is absolutely no problem at all to change the SYSV script to use:

export PERL5LIB="/usr/lib/perl5/vendor_perl;$PERL5LIB"

For the systemd unit file it is, unfortunately more complex. By default the systemd unit files will not pick up any environment variables (the systems I work with in my day job only pick up PATH and LANG in systemd). It is thus not possible to have a statement like:

Environment="PERL5LIB=/usr/lib/perl5/vendor_perl;$PERL5LIB"

in the unit file. It will just evaluate to /usr/lib/perl5/vendor_perl. This is also the reason why the SQUEEZEBOX_ARGS variable from the file /etc/sysconfig/squeezeboxserver can't be used in the systemd unit file.

If someone has set the PERL5LIB variable in order to change something for squeezeboxserver, then they will have to use a drop-in file in /etc/systemd/system/squeezeboxserver.service.d. This is, unfortunately, how systemd is designed.

The systemd is in many ways different to how people are used to how Linux works. Another example is that systemd does not respect the ulimits set in /etc/security/limits.conf. Instead systemd uses it own default values. These default values can be changed system wide by editing /etc/systemd/system.conf. This can actually lead to some strange effects in some specific cases if default values are changed for a unit running as a specific user, but the values in the normal limits.conf for that user are left unchanged.

To summarise,

  • SYSV init file: I am happy to change the init file. How do I do that? By creating a new pull request?
  • systemd unit file: I wouldn't know how to do this.

Please let me know what you think.

Regards, Johan

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! Sounds good to me.

@mherger mherger merged commit 2f457a2 into LMS-Community:public/8.2 Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants