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

edgedb branch switch fails with "Invalid cross-device link" or "The system cannot move the file to a different disk drive" if the project directory is on a different filesystem than the user's home directory #1330

Closed
zackelan opened this issue May 22, 2024 · 0 comments · Fixed by #1334
Assignees

Comments

@zackelan
Copy link
Contributor

  • EdgeDB Version: 5.2 (it probably doesn't matter, other than a 5.x instance being necessary in order to attempt edgedb branch switch)
  • EdgeDB CLI Version: 5.2.0-dev (19c2cf33ff915cac2729139d66ba622e33124540, master as of 2024-05-22)
  • OS Version: NixOS 23.11.6827.383ffe076d9b

Steps to Reproduce:

  • create a cloud instance (this likely happens with local instances as well, but I haven't tested it): edgedb instance create --region aws-us-west-2 --tier free --version =5.2 zackelan/cross-filesystem-52-us-west-2

  • mount a USB flash drive, or some other way of getting onto a separate filesystem

  • initialize a project on that separate filesystem:

/mnt/test $ edgedb project init --server-instance zackelan/cross-filesystem-52-us-west-2
No `edgedb.toml` found in `/mnt/test` or above
Do you want to initialize a new project? [Y/n]
> Y
Specify the name of EdgeDB instance to use with this project [default: zackelan/cross-filesystem-52-us-west-2]:
> zackelan/cross-filesystem-52-us-west-2
Do you want to use existing instance "zackelan/cross-filesystem-52-us-west-2" for the project? [y/n]
> y
Specify branch name: [default: main]:
> main
Applying migrations...
Everything is up to date. Revision initial
Project linked
To connect to zackelan/cross-filesystem-52-us-west-2, run `edgedb`

create a branch:

/mnt/test $ edgedb branch create test
Creating branch 'test'...
OK: CREATE BRANCH

attempt to switch to the branch:

/mnt/test $ edgedb branch switch test
Switching from 'main' to 'test'
edgedb error: Invalid cross-device link (os error 18)

excerpt from straceing this command shows we're attempting rename(2) of a temp file from /mnt/test to my home directory:

readlink("/mnt", 0x7513e1afe800, 1023)  = -1 EINVAL (Invalid argument)
readlink("/mnt/test", 0x7513e1afe800, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, ".~database.tmp", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 11
write(11, "test", 4)                    = 4
close(11)                               = 0
rename(".~database.tmp", "/home/zack/.config/edgedb/projects/test-da7755e901263282076d1c7457a40a9f3eef74ab/database") = -1 EXDEV (Invalid cross-device link)
futex(0x6340dc68b070, FUTEX_WAKE_PRIVATE, 2147483647) = 0
close(5)                                = 0
close(10)                               = 0
futex(0x6e905213658, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x6e9050e9430, FUTEX_WAIT_BITSET_PRIVATE, 0, NULL, FUTEX_BITSET_MATCH_ANY) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x6340d7fff990, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 263635, NULL, FUTEX_BITSET_MATCH_ANY) = 0
write(2, "\33[38;5;9;1medgedb error:\33[0m \33[3"..., 85edgedb error: Invalid cross-device link (os error 18)
) = 85
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x6340dc39d000, 12288)           = 0
exit_group(1)                           = ?
+++ exited with 1 +++

https://man7.org/linux/man-pages/man2/rename.2.html

EXDEV
oldpath and newpath are not on the same mounted filesystem. (Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.)

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

Successfully merging a pull request may close this issue.

2 participants