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

Writing to symlinks #60

Open
Kyuuhachi opened this issue Feb 18, 2017 · 4 comments
Open

Writing to symlinks #60

Kyuuhachi opened this issue Feb 18, 2017 · 4 comments

Comments

@Kyuuhachi
Copy link

When writing to a symlink in a RO branch, the data is written to the symlink's target instead of writing to a RW branch.

Setup:

$ tree
.
├── a
├── b
│   └── file -> ../file
├── file
└── u
$ unionfs -ocow a=RW:b u
$ echo "bar" > u/file

Expected behavior:

$ cat a/file
bar
$ cat file
foo

Actual behavior:

$ cat a/file
cat: a/file: No such file or directory
$ cat file
bar
@rpodgorny
Copy link
Owner

rpodgorny commented Feb 19, 2017

hmm, i'm not really sure whether it should really behave like what you expect...

that's just how symlimks work:

radek@pupik /tmp> echo 'a' >a
radek@pupik /tmp> ln -s a b
radek@pupik /tmp> echo 'b' >b
radek@pupik /tmp> cat a
b

@Kyuuhachi
Copy link
Author

Kyuuhachi commented Feb 19, 2017

Yeah, I know that. I just feel it's kinda unintuitive that writing to a RO-file and a RO-symlink behaves differently. Since I usually use unionfs to make sure my game installations aren't dirtied by savefiles or mods, it's also kinda destructive.

My current use-case is a little more complex (as it actually involves the aforementioned symlinks), but it's mostly irrelevant.

@rpodgorny
Copy link
Owner

well, the problem here is, partially, that your symlink is pointing "outside" of the union.

anyway, if you're able to describe your use case, maybe we may come up with a solution...

@Kyuuhachi
Copy link
Author

Yeah, I know.

Basically, I'm trying to union a lot of folders together (in order to keep game, mods, and save files separate), except the folders aren't rooted at the same place. I do this by creating a tree with a lot of symlinks (which as the additional advantages of making them all lowercase, which I think improves Wine performance, as well as allowing me to put links to files as well), and then unioning that tree to keep writes separate. Sometimes, the game writes to an existing file, such as a config file. I'd like that write to go where I tell it to.

Maybe I should look for/create some kind of resolve-symlink-fs and put that between the symlink tree and the union?

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

2 participants