Skip to content

Conversation

@Rutwa189
Copy link
Contributor

@Rutwa189 Rutwa189 commented May 18, 2018

Solution to #4252 to enable users to provide a custom path for python packages.

@facebook-github-bot facebook-github-bot added the cla signed Automated label: Pull Request author has signed the osquery CLA label May 18, 2018
Copy link
Contributor

@fmanco fmanco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution here shouldn't be to remove the defaults but to allow the user to specify the path only if necessary/wanted. Keep the defaults for the case the user doesn't provide a path.

@fmanco fmanco self-assigned this May 18, 2018
@fmanco fmanco added this to the 3.3.0 milestone May 18, 2018
@fmanco fmanco added the bug label May 18, 2018
@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

@obelisk
Copy link
Contributor

obelisk commented May 18, 2018

ok to test

@osqueryer
Copy link

👎 The commit 5278afa (Job results: 3173) failed one or more tests (macOS/OS X).

@osqueryer
Copy link

🙅 The commit 5278afa (Job results: 3634) failed the code audit or documentation test.

@osqueryer
Copy link

👎 The commit 5278afa (Job results: 7184) failed one or more tests (Linux).

@npamnani-uptycs
Copy link
Contributor

I think if no explicit directory is mentioned in the query then all the python packages should be searched at default locations such as '/usr/local/lib', '/usr/lib/' etc... and reported.

Copy link
Contributor

@fmanco fmanco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. I think you can refactor the main loop to make it more readable. Also some other nits.

"/usr/lib/python2.7/site-packages/",
"/Library/Python/2.7/site-packages/",
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespaces

return;
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty line.

genPackage(path, r);
} else if (directory.find(".egg-info") != std::string::npos) {
auto path = directory + "/PKG-INFO";
auto path = directory + "PKG-INFO";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the / here and not above?

#endif
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty lines.


for (const auto& key : kPythonPath) {
genSiteDirectories(key, results);
std::set<std::string> paths;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code can be refactored to not repeat the genSiteDirectories() loop. Make paths be kPythonPath if no constraints and then have the genSiteDirectories() only once.

Column("license", TEXT, "License under which package is launched"),
Column("path", TEXT, "Path at which this module resides")
Column("path", TEXT, "Path at which this module resides"),
Column("directory", TEXT, "Directory where Python modules are located")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing trailing comma

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

@obelisk
Copy link
Contributor

obelisk commented May 21, 2018

ok to test

@fmanco
Copy link
Contributor

fmanco commented May 22, 2018

@Rutwa189 thanks for the fixes. But you've indented a block of code. Can you please take a look? Thanks!

@obelisk
Copy link
Contributor

obelisk commented May 22, 2018

@fmanco That was my fault I told her to do that to try and fix some other formatting issues and now we're wondering why code audit isn't catching this stuff.

@Rutwa189
Copy link
Contributor Author

@fmanco I will fix the formatting.

@fmanco
Copy link
Contributor

fmanco commented May 22, 2018

@obelisk yeah I wondered the same, but tests are passing...

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request.

@osqueryer
Copy link

🙅 The commit 69bbd79 (Job results: 3651) failed the code audit or documentation test.

@osqueryer
Copy link

🙅 The commit c148f33 (Job results: 3653) failed the code audit or documentation test.

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

@osqueryer
Copy link

🙅 The commit 66f1b0c (Job results: 3654) failed the code audit or documentation test.

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

@osqueryer
Copy link

🙅 The commit 41d1c55 (Job results: 3655) failed the code audit or documentation test.

@facebook-github-bot
Copy link

@Rutwa189 has updated the pull request. View: changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cla signed Automated label: Pull Request author has signed the osquery CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants