Giter Club home page Giter Club logo

go-coreutils's People

Contributors

aisola avatar akiradeveloper avatar don42 avatar frankscholten avatar mmstick avatar prikprak avatar tmc avatar tsu-root avatar ttacon avatar xercoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-coreutils's Issues

huge binaries

Hi... cool project.
I was just checking it out and noticed the binaries are anywhere from 2.3M to 3.6M

Perhaps this would benefit from a design similar to busybox where there is just a single binary with symlinks to it and it knows which command to run via argv[0].

... either that or wait for Go to get the binary size under control.

Use thirdparty GNU style flag packages

The flag package in golang doesn't support combination of short flags.

e.g. in GNU style, -help means -h -e -l -p, and -n1 means -n=1.

But in Go -help means --help, and -n1 means --n1. Without a proper GNU style flag parser, there's no easy way to support things like tail -n10.

Here's a short list of packages I googled that do GNU style flag parsing:

I'll be happy to provide some PR if any of the packages are accepted as replacement.

wc.go fails on large files

Running wc.go on a large file destroys my 8GB of RAM. On a 550MB file it works fine, but on a 3.3GB file my computer freezes.

Flags

Are these utilities going to have the same flags as normal? I just ask because I skimmed cat.go (as an example) and I didn't see all the normal flags I'd expect.

mkdir parent/verbose output not identical to Gnu mkdir

As described in 0c29544 the output of this mkdir implementation shows only the path to the deepest folder, whereas gnu mkdir list all intermediary folders that were created.
This happens when --verbose and --parents options are combined.
Is it necessary for this implementation to provide the same output as the gnu version?

busybox style build

If we link all programs into the same binary, then differentiate with symlink or first arg, it might make the resulting binary managable.

Certain commands fail to build

The commands cat, groups, logname, and whoami all fail with this error

# _/home/e5ten/github/go-coreutils/<command name>
runtime/cgo(.text): relocation target pthread_mutex_lock not defined
runtime/cgo(.text): relocation target pthread_mutex_unlock not defined
runtime/cgo(.text): relocation target pthread_mutex_lock not defined
runtime/cgo(.text): relocation target pthread_mutex_unlock not defined
runtime/cgo(.text): relocation target pthread_mutex_lock not defined
runtime/cgo(.text): relocation target pthread_mutex_unlock not defined
runtime/cgo(.text): relocation target pthread_mutex_lock not defined
runtime/cgo(.text): relocation target pthread_mutex_unlock not defined
runtime/cgo(.text): undefined: "pthread_mutex_lock"
runtime/cgo(.text): undefined: "pthread_mutex_unlock"
runtime/cgo(.text): undefined: "pthread_mutex_lock"
runtime/cgo(.text): undefined: "pthread_mutex_unlock"
runtime/cgo(.text): undefined: "pthread_mutex_lock"
runtime/cgo(.text): undefined: "pthread_mutex_unlock"
runtime/cgo(.text): undefined: "pthread_mutex_lock"
runtime/cgo(.text): undefined: "pthread_mutex_unlock"```

implement `du`

this made me sad today

disk_usage() {
    # normalize du across systems
    case $(uname -s) in
        Linux)
            DU="du -sb"
            ;;
        FreeBSD)
            DU="du -s -A -B 1"
            ;;
        Darwin | DragonFly)
            DU="du"
            ;;
    esac
        $DU "$1" | awk "{print \$1}"
}

maybe this project can make a go-du that's the same everywhere :)

Reduce binary size by using symlinks to functions

You will probably save alot of binary size when you implement symlink-style executables like busybox does. There is one big executable with all the commands inside and the symlinks point to the busybox executable. When the symlink is executed os.Argv[0] is read and checked and dispatched to the correct command. (https://www.busybox.net)

You could do this in golang very easy:

package main

import (
    "fmt"
    "os"
    "path"
)

func func1() {
    fmt.Printf("Hello world from func1(args: %+v)\n", os.Args)
}

func main() {
    if path.Base(os.Args[0]) == "func1" {
        func1()
    }
}
$ go build main.go
$ ln -s main func1
$ ./func1 1234 5678 9012
Hello world from func1(args: [./func1 1234 5678 9012])

Its just an idea :-)

ls /root says "No such file or directory." instead of "Permission denied"

I did ls on /root from my user expecting that the command would show "Permission Denied". Instead it prints "No such file or directory".

The coreutils ls command indicates that I do not have permission to list /root folder by printing "Permission Denied".

I am new to Go. And am looking at this project in order to learn.
Could someone please fix it.

wc.go cannot handle non-ASCII characters

For instance, the paragraph (I have no clue what it means):

ことしで65回目を迎える年末恒例のNHK紅白歌合戦に出場する歌手が決まり、26日、発表されました。ことしの紅白歌合戦は、初出場の5組を含め、紅白合わせて51組が出場します。東京・渋谷のNHK放送センターでは、初出場の方たちが記者会見で意気込みを語りました。出場歌手の一覧のほか、2組の出場歌手の会見動画も併せてご覧下さい。

According to GNU's wc, it should print 0 new lines, 1 word, 161 chars, 483 bytes, and a line-length of 322. Instead, it prints 0 l, 1 w, 483 m, 483 c, 483 L.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.