| Summary: | databases/mariadb*: warnings when used in conjunction with shells/fish | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | s13k |
| Component: | Individual Port(s) | Assignee: | Alan Somers <asomers> |
| Status: | Closed Not A Bug | ||
| Severity: | Affects Some People | CC: | s13k |
| Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(asomers) |
| Version: | Latest | ||
| Hardware: | amd64 | ||
| OS: | Any | ||
|
Description
s13k
2022-08-19 11:46:56 UTC
Did the mysql-server RC script change HOME or something? What is the value of $HOME before and after running that command? $ echo $HOME
/root
I didn't touch mysql-server RC script and I guess it might be something inside /usr/local/bin/mysqld_safe
For the record, this is the contents of my /usr/local/etc/rc.d/mysql-server script:
$ cat /usr/local/etc/rc.d/mysql-server
#!/bin/sh
# PROVIDE: mysql
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_(instance_)?enable (bool): Set to "NO" by default.
# Set it to "YES" to enable MySQL.
# mysql_(instance_)?dbdir (str): Default to "/var/db/mysql"
# Base database directory.
# mysql_(instance_)?args (str): Custom additional arguments to be passed
# to mysqld_safe (default empty).
# mysql_(instance_)?pidfile (str): Custum PID file path and name.
# Default to "${mysql_dbdir}/${hostname}.pid".
# mysql_(instance_)?user (str): User to run mysqld as
# Default to "mysql" created by the port
# mysql_(instance_)?optfile (str): Server-specific option file.
# Default to "${mysql_dbdir}/my.cnf".
# mysql_(instance)?rundir (str): Default to "/var/run/mysql"
# mysql_instances (str): Set to "" by default.
# If defined, list of instances to enable
. /etc/rc.subr
name="mysql"
rcvar=mysql_enable
load_rc_config $name
: ${mysql_enable="NO"}
: ${mysql_user="mysql"}
: ${mysql_dbdir="/var/db/mysql"}
: ${mysql_optfile="/usr/local/etc/mysql/my.cnf"}
: ${mysql_rundir="/var/run/mysql"}
command="/usr/sbin/daemon"
procname="/usr/local/libexec/mariadbd"
start_precmd="${name}_prestart"
start_postcmd="${name}_poststart"
if [ -n "$2" ]; then
instance="$2"
load_rc_config ${name}_${instance}
case "$mysql_instances" in
"$2 "*|*" $2 "*|*" $2"|"$2")
eval mysql_args="\${mysql_${instance}_args:-\"${mysql_args}\"}"
eval mysql_dbdir="\${mysql_${instance}_dbdir:-\"/var/db/mysql_${instance}\"}"
@comment eval mysql_limits="\${mysql_${instance}_limits:-\"${mysql_limits}\"}"
eval mysql_user="\${mysql_${instance}_user:-\"${mysql_user}\"}"
@comment eval mysql_limits_args="\${mysql_${instance}_limits_args:-\"-e -U $mysql_user\"}"
eval mysql_socket="\${mysql_${instance}_socket:-\"/var/run/mysql_${instance}/mysql.sock\"}"
eval mysql_optfile="\${mysql_${instance}_optfile:-\"/usr/local/etc/mysql_${instance}/my.cnf\"}"
eval mysql_pidfile="\${mysql_${instance}_pidfile:-\"/var/run/mysql_${instance}/mysqld.pid\"}"
;;
*)
err 1 "$2 not found in mysql_instances" ;;
esac
else
if [ -n "${mysql_instances}" -a -n "$1" ]; then
for instance in ${mysql_instances}; do
eval _enable="\${mysql_${instance}_enable}"
case "${_enable:-${mysql_enable}}" in
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
continue
;;
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
;;
*)
if [ -z "$_enable" ]; then
_var=mysql_enable
else
_var=mysql_${instance}_enable
fi
warn "Bad value" \
"'${_enable:-${mysql_enable}}'" \
"for ${_var}. " \
"Instance ${instance} skipped."
continue
;;
esac
echo "===> mysql instance: ${instance}"
if /usr/local/etc/rc.d/mysql-server $1 ${instance}; then
success="${instance} ${success}"
else
failed="${instance} (${retcode}) ${failed}"
fi
done
exit 0
else
mysql_pidfile=${mysql_pidfile:-"/var/run/mysql/mysqld.pid"}
fi
fi
pidfile=$mysql_pidfile
mysql_install_db="/usr/local/bin/mariadb-install-db"
mysql_install_db_args="--basedir=/usr/local --datadir=${mysql_dbdir} --force"
command_args="-c -f /usr/local/bin/mariadbd-safe --defaults-extra-file=${mysql_optfile} --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_socket:+--socket=${mysql_socket}} ${mysql_args}"
mysql_create_auth_tables()
{
eval $mysql_install_db $mysql_install_db_args
[ $? -eq 0 ] && chown -R ${mysql_user}:$(id -gn $mysql_user) ${mysql_dbdir}
}
mysql_prestart()
{
local dir
for dir in /etc /usr/local/etc /etc/mysql /var/db/mysql; do
if [ -f "${dir}/my.cnf" ]; then
echo "Please merge existing ${dir}/my.cnf file with /usr/local/etc/mysql/conf.d/server.cnf"
return 1
fi
done
if [ ! -d "${mysql_dbdir}/mysql/." ]; then
mysql_create_auth_tables || return 1
fi
mysql_group="`/usr/bin/id -gn ${mysql_user}`"
[ "${mysql_socket}" = "" ] && mysql_rundir="/var/run/mysql" || mysql_rundir="`/usr/bin/dirname ${mysql_socket}`"
if [ ! -d "${mysql_rundir}" ]; then
install -d -o ${mysql_user} -g ${mysql_group} "${mysql_rundir}"
fi
return 0
if [ ! -d "${mysql_rundir}" ]; then
install -d -u${mysql_user} -g$(id -gn $mysql_user) -m755 ${mysql_rundir}
fi
}
mysql_poststart()
{
local timeout=15
while [ ! -f "${pidfile}" -a ${timeout} -gt 0 ]; do
timeout=$(( timeout - 1 ))
sleep 1
done
return 0
}
run_rc_command "$1"
/usr/local/bin/mysqld_safe is a symlink to /usr/local/bin/mariadbd-safe When I try to use /usr/local/etc/rc.d/mysql-server directly, it uses proper $HOME, but still gives warnings:
> /usr/local/etc/rc.d/mysql-server restart
Stopping mysql.
error: can not save history
warning-path: Unable to locate data directory derived from $HOME: '/root/.local/share/fish'.
warning-path: The error was 'Permission denied'.
warning-path: Please set $HOME to a directory where you have write access.
error: can not save universal variables or functions
warning-path: Unable to locate config directory derived from $HOME: '/root/.config/fish'.
warning-path: The error was 'Permission denied'.
warning-path: Please set $HOME to a directory where you have write access.
Waiting for PIDS: 11867.
Starting mysql.
error: can not save history
warning-path: Unable to locate data directory derived from $HOME: '/root/.local/share/fish'.
warning-path: The error was 'Permission denied'.
warning-path: Please set $HOME to a directory where you have write access.
error: can not save universal variables or functions
warning-path: Unable to locate config directory derived from $HOME: '/root/.config/fish'.
warning-path: The error was 'Permission denied'.
warning-path: Please set $HOME to a directory where you have write access.
Running /usr/local/bin/mariadbd-safe manually doesn't produce those warnings. See also: https://github.com/fish-shell/fish-shell/issues/4573 🤷♂️ |