Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure --with-default-config-file=[FILE] create sub-directories #2112

Open
rohara opened this issue Mar 1, 2022 · 1 comment
Open

configure --with-default-config-file=[FILE] create sub-directories #2112

rohara opened this issue Mar 1, 2022 · 1 comment

Comments

@rohara
Copy link
Contributor

rohara commented Mar 1, 2022

Describe the bug
When the configure script uses the --with-default-config-file=[FILE] option and FILE points to a file in a specific sub-directory, the PATH to the file is created and installed. Easier to explain with an example. See below.

To Reproduce
Run the configure script with the --with-default-config-file option and point to a file in an absolute or relative path (I did relative). I'm also using --prefix for testing purposes.

mkdir /tmp/root/
./configure --prefix=/tmp/root/ --with-default-config-file=./doc/samples/keepalived.conf.sample
make
make install

Now, since our prefix is '/tmp/root/', the config file will be installed to '/tmp/root/etc/keepalived/./doc/samples/keepalived.conf.sample'. This is not at all what I expected. It seems that this configure option is a bit too literal. The way it works now it seems that you're only truly getting a default config file if you use "keepalived.conf" as the FILE.

Expected behavior
My expectation was that the path/file passed to --with-default-config-file would be installed to "$PREFIX/etc/keepalived/keepalived.conf" -- that is the default config file location. Instead, it created the exact path/file as specified.

Keepalived version

Keepalived v2.2.7 (01/16,2022)

Copyright(C) 2001-2022 Alexandre Cassen, <acassen@gmail.com>

Built with kernel headers for Linux 5.15.4
Running on Linux 5.15.4-201.fc35.x86_64 #1 SMP Tue Nov 23 18:54:50 UTC 2021
Distro: Fedora Linux 35 (Thirty Five)

configure options: --enable-debug --enable-profile --enable-snmp --enable-snmp-rfc --enable-nftables --disable-iptables --enable-sha1 --with-default-config-file=./doc/samples/keepalived.conf.sample --prefix=/home/rohara/tmp/root/

Config options:  NFTABLES LVS VRRP VRRP_AUTH VRRP_VMAC OLD_CHKSUM_COMPAT SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 TIMER_CHECK NETLINK_TIMERS SMTP_ALERT_DEBUG EPOLL_DEBUG EPOLL_THREAD_DUMP TSM_DEBUG VRRP_FD_DEBUG NETWORK_TIMESTAMP ASSERT PROFILING FILE_LOGGING LOG_FILE_APPEND RECVMSG_DEBUG EINTR_DEBUG SCRIPT_DEBUG TRACK_PROCESS_DEBUG PARSER_DEBUG CHECKSUM_DEBUG CHECKER_DEBUG SMTP_CONNECT_DEBUG DUMP_KEYWORDS INIT=systemd SYSTEMD_NOTIFY DEFAULT_CONFIG_FILE=$(sysconfdir)/keepalived/./doc/samples/keepalived.conf.sample

System options:  VSYSLOG MEMFD_CREATE IPV6_MULTICAST_ALL IPV4_DEVCONF LIBNL3 RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_L3MDEV FRA_UID_RANGE RTAX_FASTOPEN_NO_COOKIE RTA_VIA FRA_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE IFA_FLAGS LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA NET_LINUX_IF_H_COLLISION LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS IPVS_TUN_TYPE IPVS_TUN_CSUM IPVS_TUN_GRE VRRP_IPVLAN IFLA_LINK_NETNSID GLOB_BRACE GLOB_ALTDIRFUNC INET6_ADDR_GEN_MODE VRF SO_MARK

Additional context
Here is the full path:

find ~/tmp/root/etc/keepalived/ -type f
/home/rohara/tmp/root/etc/keepalived/doc/samples/keepalived.conf.sample.sample

I think it should be:

/home/rohara/tmp/root/etc/keepalived/keepalived.conf

We could use something like 'basename' to strip the PATH, then the file should just be 'keepalived.conf'.

@pqarmitage
Copy link
Collaborator

If you specify --with-default-config-file=./doc/samples/keepalived.conf.sample with doc/samples as part of the path, then I would expect that doc/samples would appear somewhere in the path to the default config file.

--with-default-config-file specifies the default path that the keepalived executable will use to open its config file if no -f option is specified to keepalived when keepalived is executed. To be "helpful" keepalived installs a default config file to that path with .sample appended, to give the user a head start in creating a working configuration file.

I would be very happy to create another configure option to specify the source location for a config file to be copied to the default config file path (possibly with .sample appended [comments appreciated]) which would achieve what I think you are expecting to happen.

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

No branches or pull requests

2 participants