Bug 1328146

Summary: [GSS](6.4.z) Start-up script jboss-as-standalone.sh does not work on RHEL 5 OS
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Paramvir jindal <pjindal>
Component: Scripts and CommandsAssignee: Miroslav Sochurek <msochure>
Status: CLOSED CURRENTRELEASE QA Contact: Peter Mackay <pmackay>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.4CC: bmaxwell, chaowan, fnasser, ihradek, lkonno, msochure, pessoft, pgier, pkremens, pmackay, rnetuka, rstancel, tcerar
Target Milestone: CR1   
Target Release: EAP 6.4.16   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-22 09:23:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1434495    

Description Paramvir jindal 2016-04-18 15:04:12 UTC
Description of problem:

EAP 6.4.4 start-up script $JBOSS_HOME/bin/init.d/jboss-as-standalone.sh tries to get successful start timestamp using following command:

grep -o '[0-9]*' $JBOSS_MARKERFILE

This however does not work on RHEL 5 OS, as grep-2.5.1 does not return regular expression result correctly when used with -o option.

Version-Release number of selected component (if applicable):
 
JBoss EAP 6.4 CP04 bring this change in the script that is not working properly.


How reproducible:

Everytime

Steps to Reproduce:
1. 
2.
3.

Actual results:


Expected results:


Additional info:

As a temporary workaround, regular expression can be modified and script then works as expected. Here is an example of such workaround command:

grep -o '[0-9]\+' $JBOSS_MARKERFILE

Comment 1 Paramvir jindal 2016-04-18 15:06:15 UTC
So here is the meaning of the regular expressions:

       -o, --only-matching
              Print only the matched (non-empty) parts of a matching line,  with  each  such
              part on a separate output line.

   Repetition

       *      The preceding item will be matched zero or more times.
       +      The preceding item will be matched one or more times.

I tried testing grep with -o option with both the regular expressions on RHEL5 as well as RHEL6 and RHEL7. Definitely there are differences and 

See the following.

For RHEL5:

	[root@rhel5 ~]# cat testrhel5 
	pushpendra
	01042016
	082236
	12345678
	90876abcd
	chavantest123
	linux4you
	[root@rhel5 ~]# grep -o '[0-9]*' testrhel5
	01042016
	082236
	12345678
	90876



For RHEL6:

	[root@rhel6 ~]# cat testrhel6
	pushpendra
	01042016
	082236
	12345678
	90876abcd
	chavantest123
	linux4you
	[root@rhel6 ~]# grep -o '[0-9]*' testrhel6 
	01042016
	082236
	12345678
	90876
	123
	4

For RHEL7:

	[root@rhel7 ~]# cat testrhel7 
	pushpendra
	01042016
	082236
	12345678
	90876abcd
	chavantest123
	linux4you
	[root@rhel7 ~]# grep -o '[0-9]*' testrhel7
	01042016
	082236
	12345678
	90876
	123
	4


Whereas for all RHEL5/6/7, we get same output for following regular expression.

	[root@rhel5 ~]# grep -o '[0-9]\+' testrhel5
	01042016
	082236
	12345678
	90876
	123
	4
	[root@rhel6 ~]# grep -o '[0-9]\+' testrhel6 
	01042016
	082236
	12345678
	90876
	123
	4
	[root@rhel7 ~]# grep -o '[0-9]\+' testrhel7
	01042016
	082236
	12345678
	90876
	123
	4

Comment 3 Chao Wang 2016-05-13 07:51:46 UTC
This deserves an upstream fix and also in jboss-as-domain.sh

Comment 4 Vlado Pakan 2016-05-13 15:04:47 UTC
Thanks for noticing this. Original PR is updated and additional PRs are created

Comment 5 JBoss JIRA Server 2016-06-14 08:31:23 UTC
Vlado Pakan <vpakan> updated the status of jira JBEAP-4590 to Resolved

Comment 8 Ivo Hradek 2017-06-07 09:07:30 UTC
Workaround is working as expected hence verified for EAP-6.4.16-CP.CR1;

Note: Mentioned change in behavior was introduced in `grep-2.5.3`

Comment 9 Petr Penicka 2017-06-22 09:23:50 UTC
Released on June 20 2017 as part of the EAP 6.4.16 maintenance release.