Skip to content

perunnode generate leads to invalid cross-device link #238

Description

@danielksan81

Description

Executing command perunnode generate creates new files for alice and bob as well as a node.yaml configuration.
Program first creates new files and folders in /tmp in Linux and then moves them to the current directory using os.Rename() function.
If /tmp dir and current dir are located on different hardware devices / partitions, using os.Rename() leads to invalid cross-device link error as described in https://pkg.go.dev/os#Rename and https://grokbase.com/t/gg/golang-dev/1354nzxn4y/os-rename-between-different-partitions.

Relates to

Expected behaviour

Files and folders are generated properly.

Current behaviour

Console output in this case:

./perunnode generate
             
Error generating node configuration artifacts: moving files: [/tmp/3927127332.yaml to node.yaml: rename /tmp/3927127332.yaml node.yaml: invalid cross-device link]
Error generating session configuration artifacts: 
moving files: 
[/tmp/2171899189.yaml to bob/session.yaml: rename /tmp/2171899189.yaml bob/session.yaml: invalid cross-device link 
/tmp/2976904831 to bob/database: rename /tmp/2976904831 bob/database: invalid cross-device link 
/tmp/2584916541 to bob/idprovider.yaml: rename /tmp/2584916541 bob/idprovider.yaml: invalid cross-device link 
/tmp/perun-node-test-keystore-3453970998 to bob/keystore: rename /tmp/perun-node-test-keystore-3453970998 bob/keystore: invalid cross-device link 
/tmp/4143713783.yaml to alice/session.yaml: rename /tmp/4143713783.yaml alice/session.yaml: invalid cross-device link 
/tmp/2086994193 to alice/idprovider.yaml: rename /tmp/2086994193 alice/idprovider.yaml: invalid cross-device link 
/tmp/3204529849 to alice/database: rename /tmp/3204529849 alice/database: invalid cross-device link 
/tmp/perun-node-test-keystore-366118720 to alice/keystore: rename /tmp/perun-node-test-keystore-366118720 alice/keystore: invalid cross-device link]

Reproducing the behaviour

  1. /tmp and current folder to execute command are located on different hardware devices / partitions
  2. Execute ./perunnode generate
Software version

commit 4a94c20

Environment information
Expand to see output from `go env` command.
# Output of "go env" command
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kud7fe/.cache/go-build"
GOENV="/home/kud7fe/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/kud7fe/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/kud7fe/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/kud7fe/dev/git/perun-node/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1011654534=/tmp/go-build -gno-record-gcc-switches"

Severity

Frequency

Always

Additional information

https://groups.google.com/g/golang-dev/c/5w7Jmg_iCJQ
https://github.com/wercker/mhook/issues/12
https://pkg.go.dev/github.com/idoall/gocryptotrader/common/file

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions