Repository navigation
implemented domainname - #183
Anonymous-AAA wants to merge 9 commits into
Conversation
|
Is anyone looking into this pr? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #183 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
might want to add what issue this would be closing additionally, may be good to add in tests here |
|
ok I will add the tests |
| ))] | ||
| use std::ffi::c_int; | ||
|
|
||
| pub(crate) fn domain_name() -> UResult<Option<CString>> { |
There was a problem hiding this comment.
this is almost exactly domain_name() from src/uu/hostname/src/net/unix.rs
same for utils.rs, the validation and errors.rs
could be shared instead of duplicated, no?
|
|
||
| fn main() { | ||
| let args: Vec<OsString> = env::args_os().collect(); | ||
| let exit_code = domainname::uumain(args.into_iter()); |
There was a problem hiding this comment.
why do we need this binary?
src/bin/hostname.rs is already a multicall binary that should pick up domainname from the feature
|
|
||
| pub(crate) fn domain_name() -> std::io::Result<Option<OsString>> { | ||
| // TODO: Should we specify ComputerNameDnsDomain instead? | ||
| // TODO: Should we call NetGetJoinInformation() instead? |
There was a problem hiding this comment.
ComputerNamePhysicalDnsDomain is the DNS domain, not the NIS/YP one
is it really what we want on windows? please remove the TODOs either way
| #[test] | ||
| fn test_set_domainname_from_invalid_file() { | ||
| domainname_cmd() | ||
| .arg("-F invalid-path") |
There was a problem hiding this comment.
this passes "-F invalid-path" as a single arg, so the file is " invalid-path"
please use .arg("-F").arg("invalid-path")
also "No such file or directory" won't match on windows
| ArgGroup::new("source-group") | ||
| .args([options::FILE, options::DOMAINNAME]) | ||
| .multiple(false), | ||
| ) |
There was a problem hiding this comment.
conflicts_with is already set on both args, do we need these two groups?
without them the expect() above could go too
| fn test_set_invalid_domainname() { | ||
| domainname_cmd() | ||
| .arg("invalid_domain_name") | ||
| .fails() |
There was a problem hiding this comment.
does the net-tools domainname reject _ too?
NIS domain names are not DNS names, please check the behavior
|
|
||
| let mut domain_name = domain_name.into_owned(); | ||
| domain_name.push(0_u8); | ||
| Ok(unsafe { CString::from_vec_with_nul_unchecked(domain_name) }) |
There was a problem hiding this comment.
please add a // SAFETY: comment
| description = "domainname ~ (uutils) show or set the system's NIS/YP domain name" | ||
|
|
||
| homepage = "https://github.com/uutils/hostname" | ||
| repository = "https://github.com/uutils/hostname/tree/main/src/uu/hostname" |
There was a problem hiding this comment.
wrong path here, and the "acl" keyword makes no sense :)
No description provided.