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

Raise when using a bad symlink #28417

Merged
merged 1 commit into from
Mar 30, 2017

Conversation

schneems
Copy link
Member

There was a case where a dev made a symlink that worked on some machines and not on others. The issue manifested itself on a machine with RAILS_ENV=staging as the had their config/environments/staging.rb symlinked to another config file. The behavior was very hard to track down.

Current behavior: If you use a bad symlink in a file, you get no warnings or failures or anything. If you have a bad symlink it just ignores the file as if it didn't exist (File.exist? returns false for a bad symlink).

Patch behavior: With this patch when a file is not present we check if a symlink exists. If it does, that indicates there is a bad symlink and we should raise

File "config/environments/staging.rb" is a symlink that does not point to a valid file

There was a case where a dev made a symlink that worked on some machines and not on others. The issue manifested itself on a machine with `RAILS_ENV=staging` as the had their `config/environments/staging.rb` symlinked to another config file. The behavior was very hard to track down.

Current behavior: If you use a bad symlink in a file, you get no warnings or failures or anything. If you have a bad symlink it just ignores the file as if it didn't exist (`File.exist?` returns false for a bad symlink).


Patch behavior: With this patch when a file is not present we check if a symlink exists. If it does, that indicates there is a bad symlink and we should raise 

```
File "config/environments/staging.rb" is a symlink that does not point to a valid file
```
@pixeltrix
Copy link
Contributor

Couldn't a symlink not existing be a valid use case for some paths?

@schneems
Copy link
Member Author

Not sure, I couldn't think of any cases where you would want an intentionally bad symlink.

@pixeltrix pixeltrix merged commit 51aa5b0 into rails:master Mar 30, 2017
@pixeltrix
Copy link
Contributor

Backported in d0343dd

pixeltrix added a commit that referenced this pull request Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants