Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: LARGEFILE (8000) overlaps with LARGEFILE (8000) #502

Closed
ncw opened this issue Jan 15, 2024 · 2 comments
Closed

panic: LARGEFILE (8000) overlaps with LARGEFILE (8000) #502

ncw opened this issue Jan 15, 2024 · 2 comments

Comments

@ncw
Copy link
Contributor

ncw commented Jan 15, 2024

When I compile and build this library for GOARCH=386 GOOS=linux I get this panic on startup

panic: LARGEFILE (8000) overlaps with LARGEFILE (8000)

goroutine 1 [running]:
github.com/hanwen/go-fuse/v2/fuse.(*flagNames).set(0xd219000, 0x8000, {0x9cdc4c6, 0x9})
	/home/ncw/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.3-0.20231120175208-cbb13ba8d29c/fuse/print.go:116 +0x25e
github.com/hanwen/go-fuse/v2/fuse.init.1()
	/home/ncw/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.3-0.20231120175208-cbb13ba8d29c/fuse/print_linux.go:14 +0x79

The panic is issued here

panic(fmt.Sprintf("%s (%x) overlaps with %s (%x)", name, flag, ie.name, ie.bits))

And this comes from this bit of init() code

openFlagNames.set(syscall.O_LARGEFILE, "LARGEFILE")

I think this is because the value is already set here

0x8000: "LARGEFILE",

This is easy to replicate

$ GOOS=linux GOARCH=386 go build
$ ./fusebug 
panic: LARGEFILE (8000) overlaps with LARGEFILE (8000)

goroutine 1 [running]:
github.com/hanwen/go-fuse/v2/fuse.(*flagNames).set(0x90b3000, 0x8000, {0x811e6cf, 0x9})
	/home/ncw/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.3-0.20231120175208-cbb13ba8d29c/fuse/print.go:116 +0x240
github.com/hanwen/go-fuse/v2/fuse.init.1()
	/home/ncw/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.3-0.20231120175208-cbb13ba8d29c/fuse/print_linux.go:14 +0x79

with

package main

import (
	"fmt"

	_ "github.com/hanwen/go-fuse/v2/fuse"
)

func main() {
	fmt.Printf("Hello world!")
}

And

module fusebug

go 1.21.4

require github.com/hanwen/go-fuse/v2 v2.4.3-0.20231120175208-cbb13ba8d29c

require golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect

Note this does not replicate on linux/amd64.

On darwin/amd64 and darwin/arm64 it gives

panic: XTIMES (80000000) overlaps with INIT_RESERVED (80000000)

goroutine 1 [running]:
github.com/hanwen/go-fuse/v2/fuse.(*flagNames).set(0xc000313500?, 0x80000000, {0x104de4686?, 0x0?})
	/Users/runner/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.2/fuse/print.go:124 +0x15[9](https://github.com/rclone/rclone/actions/runs/7520820006/job/20470909802#step:11:10)
github.com/hanwen/go-fuse/v2/fuse.init.1()
	/Users/runner/go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.4.2/fuse/print_darwin.go:[12](https://github.com/rclone/rclone/actions/runs/7520820006/job/20470909802#step:11:13) +0x2b
@nileshpatra
Copy link

nileshpatra commented Jan 28, 2024

Note this does not replicate on linux/amd64.

I confirm. On linux/amd64 the value of O_LARGEFILE is set to 0x0 so the code execution never reaches the panic since it is guarded by a

if flag&(1<<i) != 0 {

which ends up always evaluating to a 0 on 64 bit archs whenever we pass LARGEFILE flag. However on 32-bit and particularly i386, syscall.O_LARGEFILE actually evaluates to 0x8000 hence choking the code. It works fine on other 32-bit architectures where O_LARGEFILE value is different.

@hanwen
Copy link
Owner

hanwen commented Feb 9, 2024

e9e7c22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants