[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-rottlog] STATDIR is empty, so rottlog create files like /.lastweek
From: |
宋文武 |
Subject: |
[bug-rottlog] STATDIR is empty, so rottlog create files like /.lastweek |
Date: |
Tue, 23 Aug 2022 16:21:11 +0800 |
Hello, after configure and install, rottlog have an empty STATDIR
instead of expected "/var/lib/rottlog".
I believe it's caused by configure.ac:
#esc_STATDIR="${ROTT_STATDIR//\//\\/}"
So, esc_STATDIR is always empty, and then the empty value is sed into
STATDIR. And in configure.ac, its value is "${localstatedir}/rottlog",
which can't be escaped (I don't know how to expand it first...), so how
about we assume there is a safe sed seperator (like '|'), avoid escape
them:
>From 7d3dc387e171bbd7e63d90dac54d46e3c46a7004 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@member.fsf.org>
Date: Tue, 23 Aug 2022 15:56:58 +0800
Subject: [PATCH] Makefile.am: Use unescaped variables for sed.
Assume those variables don't contain '|'.
---
Makefile.am | 12 ++++++------
configure.ac | 10 ----------
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 6d84478..cb6cd91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,10 +30,10 @@ txz: all
rottlog:
@echo -n "Updating rottlog bash code... "
- @sed -e 's/^MAINDIR=.*/MAINDIR=\"$(esc_ETCDIR)\"/' \
- -e 's/^STATDIR=.*/STATDIR=\"$(esc_STATDIR)\"/' \
- -e 's/^BASE_TMP_DIR=.*/BASE_TMP_DIR=\"$(esc_TMPDIR)\"/' \
- -e 's/^LOCK=.*/LOCK=\"$(esc_LOCKFILE)\"/' \
+ @sed -e 's|^MAINDIR=.*|MAINDIR=\"$(ROTT_ETCDIR)\"|' \
+ -e 's|^STATDIR=.*|STATDIR=\"$(ROTT_STATDIR)\"|' \
+ -e 's|^BASE_TMP_DIR=.*|BASE_TMP_DIR=\"$(BASE_TMP_DIR)\"|' \
+ -e 's|^LOCK=.*|LOCK=\"$(LOCKFILE)\"|' \
src/rottlog >newrottlog
@if test -f newrottlog ; then \
echo "OK"; \
@@ -44,8 +44,8 @@ rottlog:
fi
@echo -n "Updating info pages... "
@lista='$(info_TEXINFOS)'; for M in $$lista; do \
- sed -e 's/\@\@ETCDIR/$(esc_ETCDIR)/' \
- -e 's/\@\@STATDIR/\"$(esc_STATDIR)\"/' $$M > $$M.new; \
+ sed -e 's|\@\@ETCDIR|$(ROTT_ETCDIR)|' \
+ -e 's|\@\@STATDIR|\"$(ROTT_STATDIR)\"|' $$M > $$M.new; \
if test ! -s $$M.new ; then \
echo "ERROR"; \
exit 1; \
diff --git a/configure.ac b/configure.ac
index 983b2cc..0f647af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,16 +178,6 @@ then
AC_SUBST(GUNZIP,[$GZIP -d])
fi
-AC_MSG_NOTICE([Escaping variables due to sed weakness...])
-esc_ETCDIR="${ROTT_ETCDIR//\//\\/}"
-#esc_STATDIR="${ROTT_STATDIR//\//\\/}"
-esc_TMPDIR="${BASE_TMP_DIR//\//\\/}"
-esc_LOCKFILE="${LOCKFILE//\//\\/}"
-AC_SUBST(esc_ETCDIR,[$esc_ETCDIR])
-AC_SUBST(esc_STATDIR,[$esc_STATDIR])
-AC_SUBST(esc_TMPDIR,[$esc_TMPDIR])
-AC_SUBST(esc_LOCKFILE,[$esc_LOCKFILE])
-
# Checks for library functions.
AC_OUTPUT([Makefile],
chmod 444 Makefile
--
2.37.2
Thank you!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-rottlog] STATDIR is empty, so rottlog create files like /.lastweek,
宋文武 <=