in message <[EMAIL PROTECTED]>,
wrote Doug Barton thusly...
>
> Parv wrote:
>
> > I am using FreeBSD 6. I haven't tried xorg 7.2 port(s) yet, but
> > recently did merge /usr/X11R6 to /usr/local (programs reinstalled,
> > made link to X11R6 to local, and such). On a reboot after that,
> > scripts indeed ran twice
...
> Could you try restoring the default rc.conf entry, and apply the
> patch I posted to /etc/rc.subr? It would be nice to get testing
> from someone who was actually affected by the problem.
Doug, after commenting out $local_{periodic,startup} lines in
/etc/rc.conf, the patch posted in message
<[EMAIL PROTECTED]> failed to stop double execution of
scripts.
I do not see how the statement on line 1490 ...
1489 case "$local_rc" in
1490 *[\ ]*${f}[\ ]*|*[\ ]*${f}) ;;
1491 *) local_rc="${local_rc} $f" ;;
1492 esac
... work without actually resolving the paths, at least in case of ...
lrwxr-xr-x 1 root wheel 11 May 16 16:30 /usr/X11R6@ -> /misc/local
lrwxr-xr-x 1 root wheel 11 Dec 21 2004 /usr/local@ -> /misc/local
... since 'X11R6' will always be different than 'local'.
Please look over the attached patch (where, at least in my case,
after resolving directories in $local_startup, already_seen function
calls can be omitted just before making file list). The patch is
against this /etc/rc.subr version ...
# $FreeBSD: src/etc/rc.subr,v 1.34.2.20 2007/03/16 15:34:09 yar Exp
- Parv
--
--- /etc/rc.subr--OLD Mon May 21 01:36:05 2007
+++ /etc/rc.subr Mon May 21 01:57:53 2007
@@ -1454,19 +1454,60 @@
echo ${devices2}
}
+# Check if a string, $1, already exists in a space separated collection
+# of strings, $2.
+#
+already_seen () {
+ local _subset _set _rc
+ _subset="$1"
+ _set="$2"
+ _rc=
+ case "$_set" in
+ *[\ ]${_subset}[\ ]* | *[\ ]${_subset} | ${_subset}[\ ]* )
+ _rc=0
+ ;;
+ * )
+ _rc=1
+ ;;
+ esac
+ return $_rc
+}
+
+# Resolve paths, remove duplicates. Values are stored in $real_paths, a
+# space separated string.
+#
+path_resolve () {
+ local _tmp
+ real_paths=''
+ for f in $@; do
+ _tmp=$( realpath "$f" )
+ already_seen "$_tmp" "${real_paths}" && continue
+ real_paths="$_tmp $real_paths"
+ done
+ real_paths=${real_paths% }
+}
+
# Find scripts in local_startup directories that use the old syntax
#
find_local_scripts_old () {
zlist=''
slist=''
- for dir in ${local_startup}; do
+ path_resolve ${local_startup}
+ for dir in ${real_paths}; do
+
if [ -d "${dir}" ]; then
for file in ${dir}/[0-9]*.sh; do
+
+ already_seen "$file" "${zlist}" && continue
+
grep '^# PROVIDE:' $file >/dev/null 2>&1 &&
continue
zlist="$zlist $file"
done
for file in ${dir}/[^0-9]*.sh; do
+
+ already_seen "$file" "${slist}" && continue
+
grep '^# PROVIDE:' $file >/dev/null 2>&1 &&
continue
slist="$slist $file"
@@ -1476,14 +1517,22 @@
}
find_local_scripts_new () {
+ local dir f
local_rc=''
- for dir in ${local_startup}; do
+ path_resolve ${local_startup}
+ for dir in ${real_paths}; do
+
+ already_seen "$dir" "${local_startup}" && continue
+
if [ -d "${dir}" ]; then
- for file in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`; do
- case "$file" in
+ for f in `grep -l '^# PROVIDE:' ${dir}/* 2>/dev/null`
+ do
+ case "$f" in
*.sample) ;;
- *) if [ -x "$file" ]; then
- local_rc="${local_rc} ${file}"
+ *)
+ already_seen "$f" "${local_rc}" && conitnue
+ if [ -x "$f" ]; then
+ local_rc="${local_rc} $f"
fi
;;
esac
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[EMAIL PROTECTED]"