{"id":20721498,"url":"https://github.com/cleancut/shell_cmds","last_synced_at":"2025-03-11T08:17:55.238Z","repository":{"id":66175026,"uuid":"217191380","full_name":"CleanCut/shell_cmds","owner":"CleanCut","description":"Port Apple's various shell commands from C to Rust","archived":false,"fork":false,"pushed_at":"2021-04-03T04:40:25.000Z","size":189,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T22:43:36.227Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleanCut.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-24T02:08:45.000Z","updated_at":"2021-04-03T04:40:27.000Z","dependencies_parsed_at":"2023-02-21T06:01:15.892Z","dependency_job_id":null,"html_url":"https://github.com/CleanCut/shell_cmds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanCut%2Fshell_cmds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanCut%2Fshell_cmds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanCut%2Fshell_cmds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanCut%2Fshell_cmds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleanCut","download_url":"https://codeload.github.com/CleanCut/shell_cmds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242995915,"owners_count":20218829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T03:28:08.473Z","updated_at":"2025-03-11T08:17:55.196Z","avatar_url":"https://github.com/CleanCut.png","language":"Rust","readme":"Rust port of Apple's [shell_cmds](https://opensource.apple.com/source/shell_cmds/shell_cmds-198/)\n=================================\n\nPort Apple's shell commands from C to Rust.  To learn more about ancient shell commands and Rust, and to have fun.\n\nContributing\n============\n\n-  Want to help? Please do! The easiest way to contact me to discuss things is by\n   [creating an issue](https://github.com/agileperception/shell_cmds/issues/new) or\n   [pull request](https://github.com/CleanCut/shell_cmds/pulls)\n\n- Code to port: [shell_cmds version 198](https://opensource.apple.com/source/shell_cmds/shell_cmds-198/)\n\n- Commands need a file in `src/bin/` with a `fn main()`.  For example `echo` has `src/bin/echo.rs`\n\n- To compile+run your new command (for example) `echo arg1 arg2` you would do `cargo run --bin echo -- arg1 arg2`\n\n- Use `std::env::args()` directly for the dirt-simple utilities.  Use\n  [getopts](https://doc.rust-lang.org/getopts/getopts/index.html) for the fancier ones.\n\n- Put the man pages (files ending in `.1`) in the `man/` directory.\n\n- Put the companion shell scripts in the `sh/` directory.\n\n- When there's a license header, copy it over verbatim into the `.rs` file for the binary. (Lawyer repellent.)\n\nPorting Status\n==============\n\n* [x] alias - Just a man page pointer to `builtin.1`, which is `csh`'s manpage.\n* [x] apply - Some serious pointer-loop reverse engineering on this one.\n* [x] basename - Ancient utilities are frustrating because their behavior with\n  arguments makes no blasted sense.  `basename` is one of these.  If it has\n  exactly two arguments, then it acts completely differently.\n* [x] chroot - Many calls to libc.  Seems to have matched behavior exactly, except for the buffer overflow vulnerability.\n* [ ] date\n* [x] dirname - Shares a man page with basename.\n* [x] echo - Got an education in rust Strings.\n* [ ] env\n* [ ] expr\n* [x] false - Simple.\n* [ ] find\n* [ ] getopt\n* [ ] hexdump\n* [ ] hostname\n* [ ] id\n* [ ] jot\n* [ ] kill\n* [ ] killall\n* [ ] lastcomm\n* [ ] locate\n* [ ] logname\n* [ ] mktemp\n* [ ] nice\n* [ ] nohup\n* [ ] path_helper\n* [x] printenv - Done. Did you know printenv silently ignores any extra arguments?\n* [ ] pwd\n* [ ] renice\n* [ ] script\n* [ ] seq\n* [ ] sh\n* [ ] shlock\n* [x] sleep - Instead of treating invalid input as 0 silently, we spit out the\n  usage and die.\n* [ ] su\n* [ ] systime\n* [x] tee - Done.  Good practice with `Vec`, `zip()`, `stdin/stdout/stderr`, and files.\n* [ ] test\n* [ ] time\n* [x] true - Simple.\n* [ ] uname\n* [ ] users\n* [ ] w\n* [ ] what\n* [ ] whereis\n* [ ] which\n* [ ] who\n* [ ] xargs\n* [x] yes - Did you know that `yes` takes an optional argument?\n\nBugs in Original\n================\n\nBelow is a partial list of bugs discovered in C code of Apple's [shell_cmds] which ship on macOS.\n\n[shell_cmds]: https://opensource.apple.com/source/shell_cmds/shell_cmds-198/\n\nchroot.c\n--------\n\n- Buffer Overflow: If more than 16 valid groups are provided to the `-G`\n  option, then the `gidlist` buffer overflows and starts overwriting later data\n  in the stack frame with resolved group ids.  That is not difficult to do\n  since macOS ships with over 100 valid groups by default.  In Rust, we use a\n  `Vec` to store the resolved group ids.  `Vec` is dynamically sized, so it\n  won't overflow.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleancut%2Fshell_cmds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleancut%2Fshell_cmds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleancut%2Fshell_cmds/lists"}