[packages/rc-scripts/AC-branch] backport svn-id: @12662 -- do not use `:>` which aborts whole script on error

glen glen at pld-linux.org
Mon Jun 9 19:17:04 CEST 2014


commit 9819a355cb9c04e2afc1a65ce5ef2e15b225d276
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Jun 9 20:15:12 2014 +0300

    backport svn-id: @12662 -- do not use `:>` which aborts whole script on error
    
    special builtins like `:>` abort whole script on error while `>` doesn't
    
    and that is so by POSIX:
    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01

 ...ot-use-which-aborts-whole-script-on-error.patch | 89 ++++++++++++++++++++++
 rc-scripts.spec                                    |  4 +-
 2 files changed, 92 insertions(+), 1 deletion(-)
---
diff --git a/rc-scripts.spec b/rc-scripts.spec
index b2efd0c..c36d758 100644
--- a/rc-scripts.spec
+++ b/rc-scripts.spec
@@ -9,12 +9,13 @@ Summary(pl.UTF-8):	inittab i skrypty startowe z katalogu /etc/rc.d
 Summary(tr.UTF-8):	inittab ve /etc/rc.d dosyaları
 Name:		rc-scripts
 Version:	0.4.3.7
-Release:	3
+Release:	4
 License:	GPL v2
 Group:		Base
 Source0:	ftp://distfiles.pld-linux.org/src/%{name}-%{version}.tar.gz
 # Source0-md5:	6f349b3c5e74e538e14eaab389625643
 Patch0:		0001-killproc-improve-experimental-start-stop-daemon-base.patch
+Patch1:		0001-do-not-use-which-aborts-whole-script-on-error.patch
 URL:		http://svn.pld-linux.org/cgi-bin/viewsvn/rc-scripts/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -110,6 +111,7 @@ programcıklar içerir.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %{__aclocal}
diff --git a/0001-do-not-use-which-aborts-whole-script-on-error.patch b/0001-do-not-use-which-aborts-whole-script-on-error.patch
new file mode 100644
index 0000000..76ffe3f
--- /dev/null
+++ b/0001-do-not-use-which-aborts-whole-script-on-error.patch
@@ -0,0 +1,89 @@
+From e99ccdf7ce570a3a6cf7c7d8ebcde0680d57465d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= <glen at pld-linux.org>
+Date: Sun, 26 May 2013 19:20:46 +0000
+Subject: [PATCH] do not use `:>` which aborts whole script on error
+
+special builtins like `:>` abort whole script on error while `>` doesn't
+
+and that is so by POSIX:
+http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01
+
+
+svn-id: @12662
+---
+ rc.d/init.d/sys-chroots |  8 ++++----
+ rc.d/rc.sysinit         | 10 +++++-----
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/rc.d/init.d/sys-chroots b/rc.d/init.d/sys-chroots
+index 3a32767..19ba42f 100755
+--- a/rc.d/init.d/sys-chroots
++++ b/rc.d/init.d/sys-chroots
+@@ -53,8 +53,8 @@ start() {
+ 		chroot $dir sh -c '
+ 		. /etc/rc.d/init.d/functions
+ 		# Clear mtab
+-		:>/etc/mtab
+-		[ -f /etc/cryptomtab ] && :>/etc/cryptomtab
++		> /etc/mtab
++		[ -f /etc/cryptomtab ] && > /etc/cryptomtab
+ 
+ 		# Remove stale backups
+ 		rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
+@@ -78,12 +78,12 @@ start() {
+ 
+ 		# Clean up utmp/wtmp
+ 		if ! is_no "$NEED_XFILES" ; then
+-			:>/var/run/utmpx
++			> /var/run/utmpx
+ 			touch /var/log/wtmpx
+ 			chown root:utmp /var/run/utmpx /var/log/wtmpx
+ 			chmod 0664 /var/run/utmpx /var/log/wtmpx
+ 		else
+-			:>/var/run/utmp
++			> /var/run/utmp
+ 			touch /var/log/wtmp
+ 			chown root:utmp /var/run/utmp /var/log/wtmp
+ 			chmod 0664 /var/run/utmp /var/log/wtmp
+diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
+index 92cad03..e63cbf7 100755
+--- a/rc.d/rc.sysinit
++++ b/rc.d/rc.sysinit
+@@ -72,7 +72,7 @@ relabel_selinux() {
+ 
+ # Remove duplicate entries from mtab (for vserver guest use only)
+ clean_vserver_mtab() {
+-	:>/etc/mtab.clean
++	> /etc/mtab.clean
+ 	while read device mountpoint line; do
+ 		grep -qs "$mountpoint" /etc/mtab.clean || \
+ 			echo "$device $mountpoint $line" >> /etc/mtab.clean
+@@ -465,8 +465,8 @@ fi
+ 
+ if ! is_yes "$VSERVER"; then
+ 	# Clear mtab
+-	:>/etc/mtab
+-	[ -f /etc/cryptomtab ] && :>/etc/cryptomtab
++	> /etc/mtab
++	[ -f /etc/cryptomtab ] && > /etc/cryptomtab
+ 
+ 	# Enter root, /proc, /sys and other into mtab.
+ 	mount -f / 2> /dev/null
+@@ -963,12 +963,12 @@ rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
+ {
+ # Clean up utmp/wtmp
+ if ! is_no "$NEED_XFILES"; then
+-	:>/var/run/utmpx
++	> /var/run/utmpx
+ 	touch /var/log/wtmpx
+ 	chown root:utmp /var/run/utmpx /var/log/wtmpx
+ 	chmod 0664 /var/run/utmpx /var/log/wtmpx
+ else
+-	:>/var/run/utmp
++	> /var/run/utmp
+ 	touch /var/log/wtmp
+ 	chown root:utmp /var/run/utmp /var/log/wtmp
+ 	chmod 0664 /var/run/utmp /var/log/wtmp
+-- 
+1.9.0
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rc-scripts.git/commitdiff/9819a355cb9c04e2afc1a65ce5ef2e15b225d276



More information about the pld-cvs-commit mailing list