Bug #1499

Configuration from /etc is not read when prefix configured to /usr

Added by J. Wienke almost 11 years ago. Updated almost 11 years ago.

Status:ResolvedStart date:05/17/2013
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:Configuration
Target version:Robotics Service Bus - rsb-0.9

Description

The current configuration mechanism seems to ignore configuration files in /etc in case we have configured /usr as the prefix.

Associated revisions

Revision acc95ee0
Added by J. Moringen almost 11 years ago

Compute prefix config directory correctly in src/rsc/config/Environment.{h,cpp}

fixes #1499

  • src/rsc/config.h.in: added RSC_INSTALL_PREFIX
  • src/rsc/config/Environment.{h,cpp} (prefixConfigDirectory): use
    RSC_INSTALL_PREFIX as default prefix; for "/usr" prefix use "/etc"
    as prefix config directory instead of "/usr/etc"
  • examples/Directories.cpp: new example; prints special directories
    provided by RSC

History

#1 Updated by J. Moringen almost 11 years ago

When /usr (not /) is the configured prefix, configuration files should be expected in /usr/etc (not /etc).

Btw., I may be missing something, but installing with /usr as prefix seems odd to me.

#2 Updated by J. Wienke almost 11 years ago

No, basically all programs installed to /usr expect their configuration files in /etc. This is the default for all linux distributions I know. /usr/etc/ doesn't even exist on our debian system. As an example, the debian package installs /etc/gimp which is used by /usr/bin/gimp.

#3 Updated by J. Moringen almost 11 years ago

Johannes Wienke wrote:

No, basically all programs installed to /usr expect their configuration files in /etc. This is the default for all linux distributions I know. /usr/etc/ doesn't even exist on our debian system. As an example, the debian package installs /etc/gimp which is used by /usr/bin/gimp.

True, but I thought the prefix still was / in that case, despite some stuff being installed under /usr.

#4 Updated by J. Moringen almost 11 years ago

This might help help sorting out our confusion:
http://www.gnu.org/prep/standards/html_node/Directory-Variables.html

#5 Updated by J. Moringen almost 11 years ago

The interesting part is:

‘sysconfdir’

The directory for installing read-only data files that pertain to a single machine–that is to say, files for configuring a host. Mailer and network configuration files, /etc/passwd, and so forth belong here. All the files in this directory should be ordinary ASCII text files. This directory should normally be /usr/local/etc, but write it as $(prefix)/etc. (If you are using Autoconf, write it as ‘@sysconfdir@’.)

Do not install executables here in this directory (they probably belong in $(libexecdir) or $(sbindir)). Also do not install files that are modified in the normal course of their use (programs whose purpose is to change the configuration of the system excluded). Those probably belong in $(localstatedir).

But I think this can only work because:

When building the complete GNU system, the prefix will be empty and /usr will be a symbolic link to /.

#6 Updated by J. Moringen almost 11 years ago

I'm starting to lean towards the conclusion that we need two different behaviors:

  • If prefix is set such that binaries are installed in /usr, use /etc as sysconfdir (I'm still not sure whether prefix should be / or /usr in this case)
  • For any other prefix, use PREFIX/etc as sysconfdir

#7 Updated by J. Wienke almost 11 years ago

Jan Moringen wrote:

I'm starting to lean towards the conclusion that we need two different behaviors:

  • If prefix is set such that binaries are installed in /usr, use /etc as sysconfdir (I'm still not sure whether prefix should be / or /usr in this case)
  • For any other prefix, use PREFIX/etc as sysconfdir

This is exactly what I would have though of as the solution.

#8 Updated by J. Moringen almost 11 years ago

This solution can probably be implemented in rsc::config::prefixConfigDirectory.

However, the question remains whether the specially treated prefix is / or /usr.

#9 Updated by J. Moringen almost 11 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset rsc|commit:acc95ee083f56cc63acd2f396bf47035a8da21f6.

Also available in: Atom PDF