• This repository has been archived on 16/Feb/2023
  • Stars
    star
    751
  • Rank 59,997 (Top 2 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A cross-platform port of GNU's coreutils to Go

Go coreutils

forthebadge forthebadge

This is a port of GNU's coreutils (http://www.gnu.org/software/coreutils/) that aims to be a drop-in, cross-platform replacement.

It's currently under development.

Because it imports from github.com/EricLagergren/go-gnulib, and I'm constantly refactoring, parts could break from day-to-day.

I'd recommend running go get -u ... before you file a bug report!

Pull requests are more than welcome.

Also, see https://www.github.com/EricLagergren/go-gnulib for a similar project that this project depends on.

Completed:

  • 100% Completion
  • 15/100
  • Partial Completion
  • 2/100
Utility Completeness Cross Platform Need Refactor
cat 100% Yes (Unix/Windows) No
chown 0% (* see note #1) No Yes (-R)
env 100% Yes (Unix/Windows) No
false 100% Yes (Unix/Windows) No
logname 100% No No
pwd 100% Yes (Unknown) No
sync 100% Yes (Unix/Windows) No
true 100% Yes (Unix/Windows) No
tsort 100% Yes (Unix/Windows) No
tty 100% Yes (Unix/Windows) No
uname 100% No No
uptime 90% Yes (Unix/Windows, no FreeBSD) No
users 100% No No
wc 100% Yes (Unix/Windows) No
whoami 100% Yes (Unix/Windows No
xxd 100% Yes (Unix/Windows) No
yes 100% Yes (Unix/Windows) No
  • chown note: Currently refactoring from the ground-up.

Side notes:

  • Unix should include OS X unless otherwise specified.
  • Gofmt means it needs its styling changes (e.g. variable names, formatting, etc.)
  • Idiomatic means it needs to be changed to more idiomatic Go
  • Windows coverage will increase when I get a Windows laptop

Information:

Performance:

Obviously there's some things Go can do better (parallelism and concurrency), but for the most part these tools should have nearly the same speed, with Go being slightly slower.

eric@archbox $ time ./wc_go -lwmc one_gigabyte_file.txt 
  32386258  146084896 1182425560 1183778772 one_gigabyte_file.txt

real  0m25.206s
user  0m24.900s
sys   0m0.313s
eric@archbox $ time wc_c -lwmc one_gigabyte_file.txt 
  32386258  146084896 1182425560 1183778772 one_gigabyte_file.txt

real  0m22.841s
user  0m22.570s
sys   0m0.257s

Behavior:

These utilities should be nearly identical to GNU's coreutils.

Since parsing the output of shell commands isn't uncommon (even if it is bad behavior), most of the commands should have output that is nearly identical to the original GNU commands.

Do note that sometimes the results could differ a little for select commands.

For example, GNU's wc utility relies on the current locale to determine whether it should parse multi-byte characters or not.

The Go version, on the other hand, uses the unicode/utf8 package which natively detects multi-byte sequences. The trade-off is this: the Go version is technically more correct, while the C version is faster.

Our implementation of xxd is actually much faster than the native xxd implementation found on most *nix machines -- try it out!

REQUIRES:

(Depends on platform and command...)

  • go get github.com/EricLagergren/ostypes
  • go get golang.org/x/sys/unix
  • go get github.com/EricLagergren/go-gnulib/ttyname
  • go get github.com/EricLagergren/go-gnulib/sysinfo
  • go get github.com/EricLagergren/go-gnulib/posix
  • go get github.com/EricLagergren/go-gnulib/general
  • go get github.com/EricLagergren/go-gnulib/login

LICENSE:

   Copyright (C) 2014-2016 Eric Lagergren

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.

License subnotes:

It (as a whole) is licensed under the GPLv3 because it's mostly a transliteration of GNU's coreutils, which are licensed under the GPLv3.

However, certain parts have their own licenses (e.g., xxd is public domain).

More Repositories

1

decimal

A high-performance, arbitrary-precision, floating-point decimal library.
Go
516
star
2

go-gnulib

A collection of parts of GNU's libc, POSX libs, and Windows functions ported to Go
Go
74
star
3

patch

A simple exercise in hot-patching Go.
Go
29
star
4

go-llvm-mca

Run Go executables under llvm-mca
Go
13
star
5

lwcrypto

NIST Lightweight Cryptography finalists
Go
10
star
6

cidr-javascript

A fully functioning subnetting calculator
JavaScript
10
star
7

aegis

Implementation of https://www.ietf.org/archive/id/draft-denis-aegis-aead-00.html / https://competitions.cr.yp.to/round3/aegisv11.pdf
Assembly
8
star
8

polyval

POLYVAL per RFC 8452
Go
8
star
9

fixed

Go
8
star
10

node-ipcalc

node-js implementation of *nix's ipcalc
JavaScript
8
star
11

siv

AES-GCM-SIV per RFC 8452
Go
6
star
12

bloom-c

Bloom filter in C
C
5
star
13

pi-stats

Record statistics from a Raspberry Pi's VideoCore processor
C++
5
star
14

bloom

Bloom filter in Go
Go
5
star
15

rocca

Rocca: An Efficient AES-based Encryption Scheme for Beyond 5G - https://eprint.iacr.org/2022/116.pdf
C
4
star
16

pnwconference

Source code for pwnconference.gop
Go
4
star
17

proc

Some routines for processing procfs files.
Go
4
star
18

hctr2

Length-preserving encryption algorithm https://eprint.iacr.org/2021/1441.pdf
Assembly
3
star
19

dr

Double Ratchet Algorithm
Go
2
star
20

compressedhandler

Go middleware to compress HTTP responses.
Go
2
star
21

go-kml

A KML library adhering to KML Version 2.2
Go
2
star
22

ipcalc

python implementation of *nix's ipcalc
Python
2
star
23

hash_table

relatively simple C hash table
C
1
star
24

WA-VRDB-scraping

Scrapes Washington' VRDB
Python
1
star
25

monkslookingatbeer

a stupid script I wrote to tweet pictures of monks looking at beer
Go
1
star
26

sysinfo

CPU detection
Go
1
star
27

rsa

RSA Accumulator
Go
1
star
28

multi-test

Test your Go applications in different Docker containers.
Go
1
star
29

big

Rust Big Decimal library.
Rust
1
star
30

polyval-rs

1
star
31

hctr2-rs

Length-preserving encryption algorithm https://eprint.iacr.org/2021/1441.pdf
Rust
1
star
32

syslogd

a syslog daemon
Go
1
star
33

sha256

Experiments with SHA-256
C
1
star
34

ocb3

OCB3 - Offset Codebook Mode
Go
1
star
35

subtle

Go
1
star
36

forro

Rust
1
star
37

saferand

A cryptographically secure implementation of math/rand or exp/rand - WIP
Go
1
star
38

mango-doc

Automatically exported from code.google.com/p/mango-doc
Go
1
star
39

dndk-gcm

Double Nonce Derive Key AES-GCM (DNDK-GCM)
1
star
40

forkevent

/proc/sys/kernel/random/fork_event
Go
1
star
41

go-prng

Various PRNG generators translated to Go
Go
1
star