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

Regression introduced with v0.1.5 with BusyBox v1.22.1 #52

Open
peteroreil opened this issue Apr 7, 2017 · 6 comments
Open

Regression introduced with v0.1.5 with BusyBox v1.22.1 #52

peteroreil opened this issue Apr 7, 2017 · 6 comments
Labels

Comments

@peteroreil
Copy link

I'm using this library on an Intel Galileo,
Which is running BusyBox v1.22.1 (2015-10-25 11:24:34 GMT) multi-call binary.

          var psNode = require('ps-node');

            psNode.lookup({ pid: pId }, function(err, resultList) {
                if(err) return reject(err);
                return done(resultList[0]);
            });

When I pass a running pId to the lookup function in v0.1.4, the resultList will return an array with
the running process details.

When I pass a running pId to the lookup function in v0.1.5 the resultList will return an empty array.

ps usage options on busybox a.k.a none

root@hostname:~/peter/ps-mon# ps --help
BusyBox v1.22.1 (2015-10-25 11:24:34 GMT) multi-call binary.

Usage: ps 

ps table fields on BusyBox

PID USER VSZ STAT COMMAND

@neekey neekey added the bug label Apr 21, 2017
@neekey
Copy link
Owner

neekey commented Apr 21, 2017

@peteroreil thanks for reporting this issue, I don't know much about BusyBox but can you clone this project and run test npm test with BusyBox first?

@peteroreil
Copy link
Author

Actually need to update this ticket, recently learned (thanks to ps-node I might add) that ps on BusyBox does take options. ps l is a valid option.

@peteroreil
Copy link
Author

peteroreil commented Apr 21, 2017

@neekey
ran tests on v0.1.5

 81 passing (6m)
  4 failing

  1) test #lookup() by id:

      Uncaught AssertionError: "/home/root/" == "/home/root/galileo-dsu/node_modules/ps-node/test/node_process_for_test.js"
      + expected - actual

      -/home/root/
      +/home/root/galileo-dsu/node_modules/ps-node/test/node_process_for_test.js
      
      at test/test.js:53:16
      at lib/index.js:182:7
      at ChildProcess.<anonymous> (lib/index.js:97:9)
      at Process.ChildProcess._handle.onexit (child_process.js:789:12)

  2) test #lookup() by command & arguments:

      Uncaught AssertionError: 0 == 1
      + expected - actual

      -0
      +1
      
      at test/test.js:61:16
      at lib/index.js:182:7
      at ChildProcess.<anonymous> (lib/index.js:97:9)
      at Process.ChildProcess._handle.onexit (child_process.js:789:12)

  3) test #lookup() by arguments, the matching should be case insensitive :

      Uncaught AssertionError: 0 == 1
      + expected - actual

      -0
      +1
      
      at test/test.js:70:16
      at lib/index.js:182:7
      at ChildProcess.<anonymous> (lib/index.js:97:9)
      at Process.ChildProcess._handle.onexit (child_process.js:789:12)

  4) test #lookup() should work correctly with options `aux`:
     Uncaught TypeError: Cannot read property 'length' of undefined
      at test/test.js:92:26
      at lib/index.js:156:14
      at ChildProcess.<anonymous> (lib/index.js:94:16)
      at Process.ChildProcess._handle.onexit (child_process.js:789:12)

I think you can mark this one as can't reproduce.
Even those these tests are failing, these tests are still returning a process object.

The tests (Test 1 at least) that are failing are due issue #54 which I reported, which looks like is platform specific,

Regarding issue #54, the tests pass when I'm running on Ubuntu but BusyBox is not so co-operative. For some reason, the arguments array is shortened when running on BusyBox even though the output from the ps command shows the full argument list.

Thanks

@neekey
Copy link
Owner

neekey commented Apr 26, 2017

Hi @peteroreil thanks for all these detailed info, really helps to figure out the issue!

So according to your report, my suspicions are:

  • For the first three test fails, I think the problem may be caused by the incompatible ps command output format, which is parsed by table-parser, so it will be helpful if you can provide the raw ps command output for these tests
  • The fourth test fail seems to be some error happened during the lookup(), since it's the only case that the result list will be null and it should already pass out an err object. Can you check if the ps command in BusyBox supports ps aux?

@alexmufatti
Copy link

I think there is the same problem on MacOS.
There is something wrong in the ps output parsing so that values are associated with the wrong column.

@peteroreil
Copy link
Author

@neekey I'm sorry, I never seen this reply. :( The version of busybox I was using did not support aux options, just l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants