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

Process user should eq ["longusername"]: usernames get truncated with a '+' at the end #995

Closed
TD-4242 opened this issue Aug 30, 2016 · 6 comments
Labels
Type: Bug Feature not working as expected
Milestone

Comments

@TD-4242
Copy link

TD-4242 commented Aug 30, 2016

Description

When testing for a username running a command if it is more than 8 characters it gets truncated as per the default ps command.

InSpec and Platform Version

inspec 0.29.0 from chefdk 0.17.17

Replication Case

describe processes('process') do
  its('users') { should eq ['longusername'] }
end

  1) Processes users should eq ["longusername"]
     Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }

       expected: ["longusername"]
            got: ["longuse+"]

Possible Solutions

http://askubuntu.com/questions/523673/ps-aux-for-long-charactered-usernames-shows-a-plus-sign

Current workaround

shorten test to first 7 letters and a plus(+) sign:

describe processes('process') do
  its('users') { should eq ['longuse+'] }
end
@chris-rock
Copy link
Contributor

@TD-4242 Thanks for reporting. Are you aware of a solution that works without a fixed character length?

@TD-4242
Copy link
Author

TD-4242 commented Aug 31, 2016

I don't, but I can dig a little further, I'm sure there is something.

@chris-rock
Copy link
Contributor

That would be awesome.

@TD-4242
Copy link
Author

TD-4242 commented Sep 9, 2016

ps -C <process_name> -o user=

might be the trick?

@alexpop
Copy link
Contributor

alexpop commented Oct 17, 2016

Hey Bill, can you try out the code in this PR?
#1225

Here's how you can try it out:

git clone https://github.com/alexpop/inspec
cd inspec
git checkout ag-ap/processes-user-comm
bundle install
bundle exec inspec exec ...

@alexpop
Copy link
Contributor

alexpop commented Oct 18, 2016

I'm going to merge #1225.
Bill, @Anirudh-Gupta and everyone involved with this issue. Your help is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants