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

Fix /save replacing symlinks with regular files #909

Merged
merged 2 commits into from Aug 27, 2018
Merged

Conversation

@meribold
Copy link
Contributor

@meribold meribold commented Aug 12, 2018

A side-effect of 8deb618 is that /save may replace configuration files that are symlinks with regular files. Fix this by resolving all symlinks before renaming the temporary file.

This fixes #906.

A side-effect of 8deb618 is that `/save` may replace configuration files
that are symlinks with regular files.  Fix this by resolving all
symlinks before renaming the temporary file.
@ailin-nemui
Copy link
Contributor

@ailin-nemui ailin-nemui commented Aug 12, 2018

rename doesn't work if symlink point to another FS, I didn't check your fix yet but did you consider this?

@meribold
Copy link
Contributor Author

@meribold meribold commented Aug 12, 2018

I didn't. I can change the code to base the path of the temporary file on the expanded path of the configuration file. I assume that would take care of this issue.

Make sure the temporary file in the `config_write` function is created
on the same file system as the file we `rename` it to later.
@meribold
Copy link
Contributor Author

@meribold meribold commented Aug 12, 2018

I added another commit that should prevent renames across file systems.

@ailin-nemui
Copy link
Contributor

@ailin-nemui ailin-nemui commented Aug 13, 2018

@ailin-nemui
Copy link
Contributor

@ailin-nemui ailin-nemui commented Aug 20, 2018

@ailin-nemui ailin-nemui merged commit 1bbd9f3 into irssi:master Aug 27, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@dequis
Copy link
Member

@dequis dequis commented Sep 1, 2018

Turns out this breaks when the file didn't already exist

Error: Couldn't save configuration file: No such file or directory
18:50 -!- Irssi: Error saving theme to /tmp/foobar/default.theme: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants