Skip to content

Conversation

@koutheir
Copy link
Contributor

@koutheir koutheir commented Aug 20, 2021

Added implementation and tests for the runcon command.

For reference: Supporting-SELinux-in-the-coreutils.

The following testing tasks are still pending for this command:

  • Check expected exit statuses of the command.
  • Check the implementation of --compute somehow.
    I checked this manually by comparing the operation of the GNU implementation with our implementation through strace. I hope we can find a way to check this automatically instead.
  • Use unified errors (uucore/error.rs).

All runcon tests succeed on a virtual machine with SELinux enabled:

$ cargo test --features=feat_selinux -- test_runcon::
    Finished test [unoptimized + debuginfo] target(s) in 0.31s
     Running unittests (target/debug/deps/coreutils-2df32bef2901c472)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_util_name.rs (target/debug/deps/test_util_name-3c1c205336515b79)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 23 filtered out; finished in 0.00s

     Running tests/tests.rs (target/debug/deps/tests-ba1796e2d5b70410)

running 6 tests
test test_runcon::help ... ok
test test_runcon::plain_context ... ok
test test_runcon::version ... ok
test test_runcon::print ... ok
test test_runcon::invalid ... ok
test test_runcon::custom_context ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 1332 filtered out; finished in 0.12s

Closes #1973.

@sylvestre sylvestre requested review from rivy, sylvestre and tertsdiepraam and removed request for rivy August 20, 2021 09:29
@sylvestre
Copy link
Contributor

You are really impressive! Only stty will be missing after this is merged!

Copy link
Contributor

@miDeb miDeb left a comment

Choose a reason for hiding this comment

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

Thank you for your work! I only found some small issues.

@koutheir
Copy link
Contributor Author

@miDeb, thank you for the review. I implemented the discussed changes. Can you take a look?

@koutheir
Copy link
Contributor Author

koutheir commented Aug 20, 2021

The following testing tasks are still pending for this command:

  • Check expected exit statuses of the command.
  • Check the implementation of --compute somehow.
    I checked this manually by comparing the operation of the GNU implementation with our implementation through strace. I hope we can find a way to check this automatically instead.
  • Use unified errors (uucore/error.rs).

@koutheir koutheir requested a review from miDeb August 20, 2021 17:03
@miDeb
Copy link
Contributor

miDeb commented Aug 20, 2021

Check expected exit statuses of the command.

You can do this with the code_is() function in tests. E.g. new_ucmd!().args(args).fails().code_is(126).

@miDeb miDeb merged commit 7010dfd into uutils:master Aug 22, 2021
@sylvestre
Copy link
Contributor

Only stty left as a program, wahou!

@koutheir
Copy link
Contributor Author

Only stty left as a program, wahou!

stty (at least, the GNU implementation thereof) is an ugly mess...

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

Successfully merging this pull request may close these issues.

Implement runcon

3 participants