What does HackerNews think of sudo?

Utility to execute a command as another user

Language: C

You're probably running into this: https://github.com/rust-lang/cargo/issues/7058

`cargo vendor` will download dependencies and dev dependencies for all platforms, which leads to a lot of unused code being pulled in. In this case, the Windows API and Microsoft compiler wrappers.

In this instance, during the build process "tempfile" is used as a dev-dependency, which has a runtime dependency on windows-sys when compiling Windows binaries. I'm not entirely sure why (commenting it out in Cargo.toml doesn't seem to break the build).

After commenting it out and manually removing the spurious Windows API files as well as the unrelated packages (`cd vendor; rm -rf ctor diff output_vt100 pretty_assertions proc-macro2 quote syn unicode-ident yansi win*`), I get the following results:

          0.0358 secs
    ┌───────────────────────────────────────────────────────────────────────────────────────┐
    | Language                        files        size       blank     comment        code |
    ├───────────────────────────────────────────────────────────────────────────────────────┤
    | Bash                                3    939.00 B           7           2          30 |
    | C                                   1     1.31 KB           5           6          44 |
    | C Header                            1    226.00 B           0           0           7 |
    | D                                  15    31.75 KB          32           0         143 |
    | JSON                               22    39.69 KB           0           0          22 |
    | Markdown                           16    53.46 KB         425           0        1054 |
    | Rust                              396     4.98 MB       13852        9502      131650 |
    | Shell                               5     2.24 KB          11          18          50 |
    | Toml                               14     9.60 KB          54          61         319 |
    | Yaml                                2    10.14 KB          70           0         341 |
    ├───────────────────────────────────────────────────────────────────────────────────────┤
    | Sum                               475     5.13 MB       14456        9589      133660 |
    └───────────────────────────────────────────────────────────────────────────────────────┘

As a comparison, this is the output for https://github.com/sudo-project/sudo:

       0.0439 secs
 ┌───────────────────────────────────────────────────────────────────────────────────────┐
 | Language                        files        size       blank     comment        code |
 ├───────────────────────────────────────────────────────────────────────────────────────┤
 | Autoconf                          124     1.90 MB        2618        4317       59031 |
 | C                                 365     4.20 MB       15977       22626      111340 |
 | C Header                           90     1.14 MB        1816        4911       18803 |
 | JSON                                7     9.22 KB           0           0         236 |
 | Markdown                           10   133.62 KB         676           0        2498 |
 | Pascal                              3    33.63 KB          79           0         925 |
 | Perl                                2    12.81 KB          54          83         306 |
 | Plain Text                          1     15.00 B           0           0           1 |
 | Protocol Buffer                     2     5.54 KB          22           0         185 |
 | Python                             10    26.41 KB         152         259         295 |
 | Shell                              77   358.96 KB        1589        2534        8961 |
 | Yaml                                4     7.98 KB          16          38         205 |
 ├───────────────────────────────────────────────────────────────────────────────────────┤
 | Sum                               695     7.81 MB       22999       34768      202786 |
 └───────────────────────────────────────────────────────────────────────────────────────┘
It should be noted that the sudo project's dependencies and autogenerated code aren't included in this overview
To put the relative simplicity into perspective, here is the official Github mirror of sudo:

https://github.com/sudo-project/sudo

On the contributors tab:

https://github.com/sudo-project/sudo/graphs/contributors

We can see that sudo has been maintained by one person for ~29 years who has single-handedly committed ~2,936,000 changes over that time resulting in a net increase of ~480,000. It is also being actively developed with ~270,000 changes resulting in a net increase of ~40,000 lines in the last twelve months.

In contrast doas is, just eyeballing it, maybe ~500 lines and at most 1000 lines all together.