~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[alpine-aports] [PATCH] main/sysklogd: remove GNUism and use POSIX Extended Regular Expressions (EREs)

Nathan Angelacos <nangel@alpinelinux.org>
Details
Message ID
<1426109305-19657-1-git-send-email-nangel@alpinelinux.org>
Sender timestamp
1426109305
DKIM signature
missing
Download raw message
Patch: +3 -3
---
 main/sysklogd/sysklogd.daily | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/main/sysklogd/sysklogd.daily b/main/sysklogd/sysklogd.daily
index 723413d..3d98e8e 100755
--- a/main/sysklogd/sysklogd.daily
+++ b/main/sysklogd/sysklogd.daily
@@ -1,7 +1,7 @@
#!/bin/sh
# This is a shell script replacement for the sysklogd's logrotate cron script
# and syslogd-listfiles perl script. 
# Copyright (C) 2008 N. Angelacos for the Alpine Linux project  - GPL2
# Copyright (C) 2008-2015 N. Angelacos for the Alpine Linux project  - GPL2


CONF="/etc/syslog.conf"
@@ -25,9 +25,9 @@ syslogd_listfiles() {
	#		deletes lines that are not filenames with leading "/"
	#		print it
	while read a ; do echo "$a"; done < $CONF |\
		sed -n -e "s/\#.*//" \
		sed -nE -e "s/\#.*//" \
			-e "/^[[:space:]]*$/D" \
			-e "s/[[:space:]]\+/ /g" \
			-e "s/[[:space:]]+/ /g" \
			-e "s: -/: /:g" \
			-e "s/ *; */;/" \
			-e "/^.*\(auth\)[^ ]* /${skip}D" \
-- 
2.3.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20150312081159.5e532b9b@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1426109305-19657-1-git-send-email-nangel@alpinelinux.org> (view parent)
Sender timestamp
1426144319
DKIM signature
missing
Download raw message
On Wed, 11 Mar 2015 21:28:25 +0000
Nathan Angelacos <nangel@alpinelinux.org> wrote:

> ---
>  main/sysklogd/sysklogd.daily | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/main/sysklogd/sysklogd.daily b/main/sysklogd/sysklogd.daily
> index 723413d..3d98e8e 100755
> --- a/main/sysklogd/sysklogd.daily
> +++ b/main/sysklogd/sysklogd.daily
> @@ -1,7 +1,7 @@
>  #!/bin/sh
>  # This is a shell script replacement for the sysklogd's logrotate cron script
>  # and syslogd-listfiles perl script. 
> -# Copyright (C) 2008 N. Angelacos for the Alpine Linux project  - GPL2
> +# Copyright (C) 2008-2015 N. Angelacos for the Alpine Linux project  - GPL2
>  
>  
>  CONF="/etc/syslog.conf"
> @@ -25,9 +25,9 @@ syslogd_listfiles() {
>  	#		deletes lines that are not filenames with leading "/"
>  	#		print it
>  	while read a ; do echo "$a"; done < $CONF |\
> -		sed -n -e "s/\#.*//" \
> +		sed -nE -e "s/\#.*//" \
>  			-e "/^[[:space:]]*$/D" \
> -			-e "s/[[:space:]]\+/ /g" \
> +			-e "s/[[:space:]]+/ /g" \
>  			-e "s: -/: /:g" \
>  			-e "s/ *; */;/" \
>  			-e "/^.*\(auth\)[^ ]* /${skip}D" \

I think you need to change the last line to:

  			-e "/^.*(auth)[^ ]* /${skip}D" \

Test case:

  $ echo "aaabbb" | sed -E -e 's/\(a+\)\(b+\)/\2\1/'
  aaabbb
  $ echo "aaabbb" | sed -E -e 's/(a+)(b+)/\2\1/'
  bbbaaa



-nc


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Nathan Angelacos <nangel@nothome.org>
Details
Message ID
<5501986D.9070902@nothome.org>
In-Reply-To
<201503121305.17253.vkrishn4@gmail.com> (view parent)
Sender timestamp
1426167917
DKIM signature
missing
Download raw message

>>
>> I think you need to change the last line to:
>>
>>    			-e "/^.*(auth)[^ ]* /${skip}D" \
>>

Thanks Natanael, you are right.   Looks like you went ahead and fixed my 
patch.  Thanks!


>> Test case:
>>
>>    $ echo "aaabbb" | sed -E -e 's/\(a+\)\(b+\)/\2\1/'
>>    aaabbb
>>    $ echo "aaabbb" | sed -E -e 's/(a+)(b+)/\2\1/'
>>    bbbaaa
>
> Could someone also run this test after "apk add sed"
> and see if they are as expected ?

tl;dr - it works as expected with both busybox and gnu sed.

Sysklogd.daily, just printing out /etc/syslog.conf:

# ./sysklogd.daily
/var/log/cron.log
/var/log/daemon.log
/var/log/kern.log
/var/log/lpr.log
/var/log/mail.log
/var/log/user.log
And now with --auth
/var/log/auth.log
/var/log/debug
/var/log/messages
/var/log/syslog

# apk add sed
(1/1) Installing sed (4.2.2-r0)
Executing busybox-1.23.1-r0.trigger
OK: 49 MiB in 41 packages

# ./sysklogd
/var/log/cron.log
/var/log/daemon.log
/var/log/kern.log
/var/log/lpr.log
/var/log/mail.log
/var/log/user.log
And now with --auth
/var/log/auth.log
/var/log/debug
/var/log/messages
/var/log/syslog

-----

# apk del sed
(1/1) Purging sed (4.2.2-r0)
Executing sed-4.2.2-r0.post-deinstall
Executing busybox-1.23.1-r0.trigger
# echo "aaabbb" | sed -E -e 's/\(a+\)\(b+\)/\2\1/'
aaabbb
# echo "aaabbb" | sed -E -e 's/(a+)(b+)/\2\1/'
bbbaaa
# apk add sed
(1/1) Installing sed (4.2.2-r0)
Executing busybox-1.23.1-r0.trigger
OK: 49 MiB in 41 packages
# echo "aaabbb" | sed -E -e 's/\(a+\)\(b+\)/\2\1/'
sed: -e expression #1, char 20: invalid reference \2 on `s' command's RHS
# echo "aaabbb" | sed -E -e 's/(a+)(b+)/\2\1/'
bbbaaa






>
>



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Details
Message ID
<201503121305.17253.vkrishn4@gmail.com>
In-Reply-To
<20150312081159.5e532b9b@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1426145717
DKIM signature
missing
Download raw message
> On Wed, 11 Mar 2015 21:28:25 +0000
> 
> Nathan Angelacos <nangel@alpinelinux.org> wrote:
> > ---
> > 
> >  main/sysklogd/sysklogd.daily | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/main/sysklogd/sysklogd.daily b/main/sysklogd/sysklogd.daily
> > index 723413d..3d98e8e 100755
> > --- a/main/sysklogd/sysklogd.daily
> > +++ b/main/sysklogd/sysklogd.daily
> > @@ -1,7 +1,7 @@
> > 
> >  #!/bin/sh
> >  # This is a shell script replacement for the sysklogd's logrotate cron
> >  script # and syslogd-listfiles perl script.
> > 
> > -# Copyright (C) 2008 N. Angelacos for the Alpine Linux project  - GPL2
> > +# Copyright (C) 2008-2015 N. Angelacos for the Alpine Linux project  -
> > GPL2
> > 
> >  CONF="/etc/syslog.conf"
> > 
> > @@ -25,9 +25,9 @@ syslogd_listfiles() {
> > 
> >  	#		deletes lines that are not filenames with leading "/"
> >  	#		print it
> >  	while read a ; do echo "$a"; done < $CONF |\
> > 
> > -		sed -n -e "s/\#.*//" \
> > +		sed -nE -e "s/\#.*//" \
> > 
> >  			-e "/^[[:space:]]*$/D" \
> > 
> > -			-e "s/[[:space:]]\+/ /g" \
> > +			-e "s/[[:space:]]+/ /g" \
> > 
> >  			-e "s: -/: /:g" \
> >  			-e "s/ *; */;/" \
> >  			-e "/^.*\(auth\)[^ ]* /${skip}D" \
> 
> I think you need to change the last line to:
> 
>   			-e "/^.*(auth)[^ ]* /${skip}D" \
> 
> Test case:
> 
>   $ echo "aaabbb" | sed -E -e 's/\(a+\)\(b+\)/\2\1/'
>   aaabbb
>   $ echo "aaabbb" | sed -E -e 's/(a+)(b+)/\2\1/'
>   bbbaaa

Could someone also run this test after "apk add sed"
and see if they are as expected ?


-- 
Regards.
V.Krishn


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)