tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

Add os/file.Truncate

Open leongross opened this issue 1 year ago • 6 comments
trafficstars

Add file.Truncate() to file.go

leongross avatar Mar 27 '24 13:03 leongross

any update on next steps ?

10000TB avatar Apr 30 '24 05:04 10000TB

CI error does not seem to be related to the Truncate code, maybe another compiler issue? @deadprogram @aykevl, is this related to https://github.com/tinygo-org/tinygo/issues/3871?

no Go files in D:\a\tinygo\tinygo\tests\testing
ld.lld: error: undefined symbol: notARealFunction
>>> referenced by main
>>>               C:\Users\RUNNER~1\AppData\Local\Temp\tinygo1547056251\main.o
failed to run tool: ld.lld
--- FAIL: TestBuild (0.00s)
    --- FAIL: TestBuild/Host (0.00s)
        --- FAIL: TestBuild/Host/rand.go (36.58s)
            main_test.go:395: output did not match (expected 35 bytes, got 0 bytes):
FAIL
FAIL	github.com/tinygo-org/tinygo	110.872s

leongross avatar Jun 07 '24 13:06 leongross

@leongross that seems fixed in 0.29.0

10000TB avatar Jun 11 '24 17:06 10000TB

@leongross can you please rebase this PR against the latest dev? Thanks!

deadprogram avatar Jun 15 '24 09:06 deadprogram

@deadprogram rebase done

leongross avatar Jun 16 '24 11:06 leongross

Looking for review / approval ! TY

10000TB avatar Jun 25 '24 16:06 10000TB

@deadprogram @aykevl

leongross avatar Jul 05 '24 11:07 leongross

Conflicts after the wasip2 merge. This probably needs a wasip2 implementation but I'm fine to merge this with a ErrNotImplemented error for now.

dgryski avatar Jul 08 '24 23:07 dgryski

You should be able to stub this for wasip2 with this addition to libc_waisp2.go:

// int truncate(const char *path, off_t length);
//
//export truncate
func truncate(path *byte, length int64) int {
	libcErrno = ENOSYS
	return -1
}

dgryski avatar Jul 09 '24 20:07 dgryski

@leongross please see error here https://github.com/tinygo-org/tinygo/actions/runs/10009754889/job/27670027039?pr=4209#step:7:37

Probably something needs an additional build tag for Windows?

deadprogram avatar Jul 21 '24 08:07 deadprogram

Looks like we encountered a similar error as a few weeks ago @deadprogram

The following packages have unmet dependencies:
 libllvm18 : Breaks: llvm-18-dev (< 1:18.1.8~++20240730104741) but 1:18.1.8~++20240730092223+3b5b5c1ec4a3-1~exp1~20240730092238.143 is to be installed
E: Unable to correct problems, you have held broken packages.

https://github.com/llvm/llvm-project/issues/101201

EDIT: apart from the llvm packaging failure the ci passes, would appreciate a review @ayang64 @dgryski @rminnich @deadprogram

leongross avatar Jul 31 '24 08:07 leongross

llvm issues seem to be resolved by now, re-running the CI

leongross avatar Aug 01 '24 07:08 leongross

CI is green, ready to merge? @aykevl @deadprogram @dgryski @rminnich

leongross avatar Aug 01 '24 08:08 leongross

Thanks for taking care of that @aykevl!

leongross avatar Aug 03 '24 11:08 leongross