Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegExp in processes resource can't match long-run process #1332

Closed
Wing924 opened this issue Nov 29, 2016 · 1 comment
Closed

RegExp in processes resource can't match long-run process #1332

Wing924 opened this issue Nov 29, 2016 · 1 comment

Comments

@Wing924
Copy link
Contributor

Wing924 commented Nov 29, 2016

Description

It use ([^ ]+) to match each ps columns in file: lib/resources/processes.rb.
But as man page of ps says, start format may be mmm dd or HH:MM:SS.
Because mmm dd comtains space, it can't be match with the RegExp.

man of ps

start      STARTED  time the command started. If the process was started less than 24 hours ago, 
              the output format is  "HH:MM:SS", else it is "  mmm dd" 
              (where mmm is a three-letter month name). 
              See also lstart, bsdstart, start_time, and stime.

InSpec and Platform Version

Tested against 1.5 and 1.6

Replication Case

# assume httpd processes are running more than 24 hours
describe processes('httpd') do
  its('list.length') { should be >= 1 }
end

It will output

 ×  httpd process: Process httpd should be running (expected: >= 1
          got:    0)
     ×  Processes list.length should be >= 1
     expected: >= 1
          got:    0

Possible Solutions

Change 9th ([^ ]+) to (\w{3} \d{2}|\d{2}:\d{2}:\d{2})

Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 29, 2016
Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 29, 2016
@Wing924
Copy link
Contributor Author

Wing924 commented Nov 29, 2016

CI test failed on Oracle-linux installing openssh-server phase :(

Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 30, 2016
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 30, 2016
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 30, 2016
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
Wing924 pushed a commit to Wing924/inspec that referenced this issue Nov 30, 2016
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
chris-rock added a commit that referenced this issue Nov 30, 2016
fix bug: RegExp in processes resource can't match long-run process #1332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant