Skip to content

Commit

Permalink
Make Windows support explicit (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
syrmel authored Nov 28, 2024
1 parent a8151ad commit 7e5abd4
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 115 deletions.
226 changes: 115 additions & 111 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ with as many GNU extensions as feasible.
We are looking for solid, working implementations of the commands, not 100%
1-to-1 parity, especially not quirks and unintended side-effects.

The reference implementation is GNU coreutils 8.32.

## Layout

Each command has it's own separate subdirectory under `src`, in case the
Expand Down Expand Up @@ -48,114 +50,116 @@ compare against the true GNU coreutils version on the Linux-based tests first.

## Completed (73/109) - 67% done!

| Done | Cmd | Descripton |
| :-----: | --------- | ------------------------------------------------ |
| ✓ | **[** | Alternate form of `test` |
| ✓ | arch | Print machine hardware name |
| ✓ | b2sum | Print or check BLAKE2 digests |
| ✓ | base32 | Transform data into printable data |
| ✓ | base64 | Transform data into printable data |
| ✓ | basename | Strip directory and suffix from a file name |
| ✓ | basenc | Transform data into printable data |
| ✓ | cat | Concatenate and write files |
| | chcon | Change SELinux context of file |
| | chgrp | Change group ownership |
| | chmod | Change access permissions |
| | chown | Change file owner and group |
| | chroot | Run a command with a different root directory |
| ✓ | cksum | Print CRC checksum and byte counts |
| | comm | Compare two sorted files line by line |
| | coreutils | Multi-call program |
| ✓ | cp | Copy files and directories |
| | csplit | Split a file into context-determined pieces |
| ✓ | cut | Print selected parts of lines |
| | date | Print or set system date and time |
| | dd | Convert and copy a file |
| | df | Report file system disk space usage |
| | dir | Briefly list directory contents |
| | dircolors | Color setup for ls |
| ✓ | dirname | Strip last file name component |
| | du | Estimate file space usage |
| ✓ | echo | Print a line of text |
| ✓ | env | Run a command in a modified environment |
| ✓ | expand | Convert tabs to spaces |
| ✓ | expr | Evaluate expressions |
| ✓ | factor | Print prime factors |
| ✓ | false | Do nothing, unsuccessfully |
| ✓ | fmt | Reformat paragraph text |
| ✓ | fold | Wrap input lines to fit in specified width |
| ✓ | groups | Print group names a user is in |
| ✓ | head | Output the first part of files |
| ✓ | hostid | Print numeric host identifier |
| ✓ | hostname | Print or set system name |
| ✓ | id | Print user identity |
| | install | Copy files and set attributes |
| | join | Join lines on a common field |
| | kill | Send a signal to processes |
| | link | Make a hard link via the link syscall |
| ✓ | ln | Make links between files |
| ✓ | logname | Print current login name |
| ✓ | ls | List directory contents |
| ✓ | md5sum | Print or check MD5 digests |
| ✓ | mkdir | Make directories |
| ✓ | mkfifo | Make FIFOs (named pipes) |
| | mknod | Make block or character special files |
| ✓ | mktemp | Create temporary file or directory |
| ✓ | mv | Move (rename) files |
| | nice | Run a command with modified niceness |
| ✓ | nl | Number lines and write files |
| ✓ | nohup | Run a command immune to hangups |
| ✓ | nproc | Print the number of available processors |
| ✓ | numfmt | Reformat numbers |
| | od | Write files in octal or other formats |
| ✓ | paste | Merge lines of files |
| | pathchk | Check file name validity and portability |
| | pinky | Lightweight finger |
| | pr | Paginate or columnate files for printing |
| ✓ | printenv | Print all or some environment variables |
| ✓ | printf | Format and print data |
| | ptx | Produce permuted indexes |
| ✓ | pwd | Print working directory |
| ✓ | readlink | Print value of a symlink or canonical file name |
| | realpath | Print the resolved file name |
| ✓ | rm | Remove files or directories |
| ✓ | rmdir | Remove empty directories |
| | runcon | Run a command in specified SELinux context |
| ✓ | seq | Print numeric sequences |
| ✓ | sha1sum | Print or check SHA-1 digests |
| ✓ | sha224sum | Print or check SHA-2 224 bit digests |
| ✓ | sha256sum | Print or check SHA-2 256 bit digests |
| ✓ | sha384sum | Print or check SHA-2 384 bit digests |
| ✓ | sha512sum | Print or check SHA-2 512 bit digests |
| ✓ | shred | Remove files more securely |
| ✓ | shuf | Shuffling text |
| ✓ | sleep | Delay for a specified time |
| ✓ | sort | Sort text files |
| | split | Split a file into pieces |
| ✓ | stat | Report file or file system status |
| | stdbuf | Run a command with modified I/O stream buffering |
| | stty | Print or change terminal characteristics |
| ✓ | sum | Print checksum and block counts |
| ✓ | sync | Synchronize cached writes to persistent storage |
| ✓ | tac | Concatenate and write files in reverse |
| ✓ | tail | Output the last part of files |
| | tee | Redirect output to multiple files or processes |
| ✓ | test | Check file types and compare values |
| | timeout | Run a command with a time limit |
| ✓ | touch | Change file timestamps |
| | tr | Translate, squeeze, and/or delete characters |
| ✓ | true | Do nothing, successfully |
| ✓ | truncate | Shrink or extend the size of a file |
| | tsort | Topological sort |
| ✓ | tty | Print file name of terminal on standard input |
| ✓ | uname | Print system information |
| ✓ | unexpand | Convert spaces to tabs |
| ✓ | uniq | Uniquify files |
| ✓ | unlink | Remove files via the unlink syscall |
| ✓ | uptime | Print system uptime and load |
| ✓ | users | Print login names of users currently logged in |
| | vdir | Verbosely list directory contents |
| ✓ | wc | Print newline, word, and byte counts |
| | who | Print who is currently logged in |
| ✓ | whoami | Print effective user ID |
| ✓ | yes | Print a string until interrupted |
| Done | Cmd | Descripton | Windows |
| :-----: | --------- | ------------------------------------------------ | ------- |
| ✓ | **[** | Alternate form of `test` | ✓ |
| ✓ | arch | Print machine hardware name | |
| ✓ | b2sum | Print or check BLAKE2 digests | ✓ |
| ✓ | base32 | Transform data into printable data | ✓ |
| ✓ | base64 | Transform data into printable data | ✓ |
| ✓ | basename | Strip directory and suffix from a file name | ✓ |
| ✓ | basenc | Transform data into printable data | ✓ |
| ✓ | cat | Concatenate and write files | ✓ |
| | chcon | Change SELinux context of file | ✓ |
| | chgrp | Change group ownership | |
| | chmod | Change access permissions | |
| | chown | Change file owner and group | |
| | chroot | Run a command with a different root directory | |
| ✓ | cksum | Print CRC checksum and byte counts | ✓ |
| | comm | Compare two sorted files line by line | ✓ |
| | coreutils | Multi-call program | ✓ |
| ✓ | cp | Copy files and directories | ✓ |
| | csplit | Split a file into context-determined pieces | ✓ |
| ✓ | cut | Print selected parts of lines | ✓ |
| | date | Print or set system date and time | ✓ |
| | dd | Convert and copy a file | ✓ |
| | df | Report file system disk space usage | |
| | dir | Briefly list directory contents | |
| | dircolors | Color setup for ls | ✓ |
| ✓ | dirname | Strip last file name component | ✓ |
| | du | Estimate file space usage | ✓ |
| ✓ | echo | Print a line of text | ✓ |
| ✓ | env | Run a command in a modified environment | ✓ |
| ✓ | expand | Convert tabs to spaces | ✓ |
| ✓ | expr | Evaluate expressions | ✓ |
| ✓ | factor | Print prime factors | ✓ |
| ✓ | false | Do nothing, unsuccessfully | ✓ |
| ✓ | fmt | Reformat paragraph text | ✓ |
| ✓ | fold | Wrap input lines to fit in specified width | ✓ |
| ✓ | groups | Print group names a user is in | |
| ✓ | head | Output the first part of files | ✓ |
| ✓ | hostid | Print numeric host identifier | |
| ✓ | hostname | Print or set system name | |
| ✓ | id | Print user identity | |
| | install | Copy files and set attributes | |
| | join | Join lines on a common field | ✓ |
| | kill | Send a signal to processes | ✓ |
| | link | Make a hard link via the link syscall | ✓ |
| ✓ | ln | Make links between files | ✓ |
| ✓ | logname | Print current login name | ✓ |
| ✓ | ls | List directory contents | |
| ✓ | md5sum | Print or check MD5 digests | ✓ |
| ✓ | mkdir | Make directories | ✓ |
| ✓ | mkfifo | Make FIFOs (named pipes) | ✓ |
| | mknod | Make block or character special files | ✓ |
| ✓ | mktemp | Create temporary file or directory | ✓ |
| ✓ | mv | Move (rename) files | ✓ |
| | nice | Run a command with modified niceness | |
| ✓ | nl | Number lines and write files | ✓ |
| ✓ | nohup | Run a command immune to hangups | ✓ |
| ✓ | nproc | Print the number of available processors | ✓ |
| ✓ | numfmt | Reformat numbers | ✓ |
| | od | Write files in octal or other formats | ✓ |
| ✓ | paste | Merge lines of files | ✓ |
| | pathchk | Check file name validity and portability | ✓ |
| | pinky | Lightweight finger | |
| | pr | Paginate or columnate files for printing | ✓ |
| ✓ | printenv | Print all or some environment variables | ✓ |
| ✓ | printf | Format and print data | ✓ |
| | ptx | Produce permuted indexes | ✓ |
| ✓ | pwd | Print working directory | ✓ |
| ✓ | readlink | Print value of a symlink or canonical file name | ✓ |
| | realpath | Print the resolved file name | ✓ |
| ✓ | rm | Remove files or directories | ✓ |
| ✓ | rmdir | Remove empty directories | ✓ |
| | runcon | Run a command in specified SELinux context | ✓ |
| ✓ | seq | Print numeric sequences | ✓ |
| ✓ | sha1sum | Print or check SHA-1 digests | ✓ |
| ✓ | sha224sum | Print or check SHA-2 224 bit digests | ✓ |
| ✓ | sha256sum | Print or check SHA-2 256 bit digests | ✓ |
| ✓ | sha384sum | Print or check SHA-2 384 bit digests | ✓ |
| ✓ | sha512sum | Print or check SHA-2 512 bit digests | ✓ |
| | shred | Remove files more securely | ✓ |
| ✓ | shuf | Shuffling text | ✓ |
| ✓ | sleep | Delay for a specified time | ✓ |
| ✓ | sort | Sort text files | ✓ |
| | split | Split a file into pieces | ✓ |
| ✓ | stat | Report file or file system status | |
| | stdbuf | Run a command with modified I/O stream buffering | |
| | stty | Print or change terminal characteristics | |
| ✓ | sum | Print checksum and block counts | ✓ |
| ✓ | sync | Synchronize cached writes to persistent storage | |
| ✓ | tac | Concatenate and write files in reverse | ✓ |
| ✓ | tail | Output the last part of files | ✓ |
| | tee | Redirect output to multiple files or processes | ✓ |
| ✓ | test | Check file types and compare values | ✓ |
| | timeout | Run a command with a time limit | |
| ✓ | touch | Change file timestamps | ✓ |
| | tr | Translate, squeeze, and/or delete characters | ✓ |
| ✓ | true | Do nothing, successfully | ✓ |
| ✓ | truncate | Shrink or extend the size of a file | ✓ |
| | tsort | Topological sort | ✓ |
| ✓ | tty | Print file name of terminal on standard input | |
| ✓ | uname | Print system information | ✓ |
| ✓ | unexpand | Convert spaces to tabs | ✓ |
| ✓ | uniq | Uniquify files | ✓ |
| ✓ | unlink | Remove files via the unlink syscall | ✓ |
| ✓ | uptime | Print system uptime and load | |
| ✓ | users | Print login names of users currently logged in | |
| | vdir | Verbosely list directory contents | |
| ✓ | wc | Print newline, word, and byte counts | ✓ |
| | who | Print who is currently logged in | |
| ✓ | whoami | Print effective user ID | ✓ |
| ✓ | yes | Print a string until interrupted | ✓ |

Windows ✓ if the utility exists in the [Windows version of GNU coreutils](https://github.com/mingw-io/coreutils).
29 changes: 25 additions & 4 deletions build.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,37 @@ import os // v has a bug that you can't use args

const ignore_dirs = {
'windows': [
// avoid *nix-dependent utils
// avoid *nix-dependent utils; the following are excluded
// from Win32 GNU coreutils 8.32:
'arch',
'chgrp',
'chmod',
'chown',
'chroot',
'df',
'dir',
'groups',
'hostid',
'hostname',
'id',
'group',
'nohup',
'install',
'ls',
'nice',
'pinky',
'stat',
'stdbuf',
'stty',
'sync',
'timeout',
'tty',
// avoid utmp-dependent utils (WinOS has no utmp support)
'vdir',
// The following are excluded because utmp-dependent
// (and also not part of Win32 GNU coreutils):
'uptime',
'users',
'who',
// TODO: nohup is included in Win32 version
'nohup',
]
'macos': ['stat', 'sync', 'uptime']
}[os.user_os()] or { [] }
Expand Down

0 comments on commit 7e5abd4

Please sign in to comment.