quackduck / aces

Encode in a character set of your choice
MIT License
68 stars 3 forks source link

[Bug] Aces can't do binary (charsets of two characters or numbers) #4

Open xplshn opened 4 months ago

quackduck commented 4 months ago

Can you provide a test case that demonstrates that?

I tried it out just now: https://go.dev/play/p/Lq6W3R4Qk8I

xplshn commented 4 months ago

2024-05-03-000819_1366x768_scrot

xplshn commented 4 months ago

I don't think the bug has to do with the library

quackduck commented 4 months ago
image
xplshn commented 3 months ago

weird. This may be an issue with CGO or Musl

quackduck commented 3 months ago

so strange. try building from source again with cgo disabled?

xplshn commented 3 months ago

Sorry, not currently home, anyways

CGO is disabled on my PC. I always compile with these flags:

# Go options:
export CGO_ENABLED=0
export GOFLAGS="-ldflags=-static -ldflags=-s -ldflags=-w"
export GO_LDFLAGS="-buildmode=pie"
export GOROOT="/usr/local/go"
export GOCACHE="$HOME/.cache/go"
export GOBIN="$HOME/.local/bin"
export GOPATH="$HOME/.cache/go"
# Zig options:
export ZIG_LIBC_TARGET="x86_64-linux-musl"
# Rust options:
export RUSTFLAGS="-C link-arg=-s"
export RUSTUP_HOME="$HOME/.cache/rs_rustup"
export CARGO_HOME="$HOME/.cache/rs_cargo"
# C options:
export LDFLAGS="-static"
export CFLAGS="-fPIE -fPIC -static"

I will rebuild once I get home, I am currently on a school PC, in which I have booted into a barebones Alpine Linux with my USB hard drive.

xplshn commented 3 months ago

I decided to just spend some of my mobile data plan, doesn't matter, fresh Golang install from the official Alpine repos also doesn't work. image

xplshn commented 3 months ago

(I have unset all the GO* vars)

quackduck commented 3 months ago

what is line 82? how are you compiling this?

quackduck commented 3 months ago

I just built from main to confirm and it works fine

xplshn commented 3 months ago

I am running go build -o ./aces ./cmd/aces/main.go

https://github.com/quackduck/aces/blob/82e8e65f81f2446e8b0db9181276a4fd6b5b04a5/cmd/aces/main.go#L82

quackduck commented 3 months ago

Could you move this right before that line and then compile?

https://github.com/quackduck/aces/blob/82e8e65f81f2446e8b0db9181276a4fd6b5b04a5/cmd/aces/main.go#L83-L86

idk why im using the value before err checking

xplshn commented 3 months ago

image Well, that's weird... Seems like the library doesn't allow it?

xplshn commented 3 months ago

...

image

quackduck commented 3 months ago

The way you're building is a little strange. Try building with just go build?

quackduck commented 3 months ago

Hmmmmmm I just opened up the code and it looks like it's obviously wrong? how the heck does it work for me?

xplshn commented 3 months ago

Since its a project that is divided into a library and cli program, it can't be built without specifying which .go file to build, AFAIK...

image

And yes, I thought the code looked weird, as if something wasn't right. It could have something to do with Go's build cache? I am not sure, but maybe you kept a working version cached at your $GOPATH/$GOCACHE.

Maybe try setting a differrent GOPATH and GOCACHE before building to see if that is true? It'd be weird but maybe, just maybe...

quackduck commented 3 months ago

Yeah so I think I was working off an old version

quackduck commented 3 months ago

No no my code is wrong lol

xplshn commented 3 months ago

image

quackduck commented 3 months ago

alright everything should be fixed now

quackduck commented 3 months ago

you can also get bins from here https://github.com/quackduck/aces/releases/tag/v2.2.7

xplshn commented 3 months ago

Could you publish releases as statically linked Go binaries? If possible using fPIE? Instead of tarfiles, also, compiling statically means it will run everywhere regardless of the presence of musl, uclibc, uclibc-ng, mlibc or the shitty gnu libc. Thanks!