Skip to content

Conversation

@ElDeveloper
Copy link
Contributor

If the base data directory was not set, a default one would be selected,
by using '..' to refer to a directory below, which in turn would
inconsistently flag users as lacking permissions:

QiitaPetAuthorizationError: User demo@microbio.me is not authorized to
access
/Users/yoshikivazquezbaeza/.virtualenvs/qiita-0.2.0-rc1/lib/python2.7/site-packages/qiita_db/support_files/test_data/job/1_summarize_taxa_through_plots.py_output_dir/taxa_summary_plots/bar_charts.html

Although the paths were the same, this is verified through string
matching thus 'lol/foo/../jk' and 'lol/jk' would not match (see example
structure below) even though they refer to the same folder:

lol/
├── foo
│   └── file.txt
├── jk
└── plel

If the base data directory was not set, a default one would be selected,
by using '..' to refer to a directory below, which in turn would
inconsistently flag users as lacking permissions:

```
QiitaPetAuthorizationError: User demo@microbio.me is not authorized to
access
/Users/yoshikivazquezbaeza/.virtualenvs/qiita-0.2.0-rc1/lib/python2.7/site-packages/qiita_db/support_files/test_data/job/1_summarize_taxa_through_plots.py_output_dir/taxa_summary_plots/bar_charts.html
```

Although the paths were the same, this is verified through string
matching thus 'lol/foo/../jk' and 'lol/jk' would not match (see example
structure below) even though they refer to the same folder:

lol/
├── foo
│   └── file.txt
├── jk
└── plel
@josenavas
Copy link
Contributor

👍 once test pass

@ElDeveloper
Copy link
Contributor Author

After chatting offline with @antgonza, it seems like we will also need a DB patch. The reason is that the settings table might already have a path of this form /Users/yoshikivazquezbaeza/.virtualenvs/qiita-0.2.0-rc1/lib/python2.7/site-packages/qiita_core/../qiita_db/support_files/test_data (notice the ..), and we really just want to change it to /Users/yoshikivazquezbaeza/.virtualenvs/qiita-0.2.0-rc1/lib/python2.7/site-packages/qiita_db/support_files/test_data.

The only way to look for this would be to query for the base_data_dir path and if it ends in ../qiita_db/support_files/test_data, then change it to the correct path. However it may be that a user could have replicated the a similar structure but with a different path, thus fixing this problem would imply removing any occurrences of .. and the preceding folder name. Does that make sense or am I overthinking this?

@josenavas
Copy link
Contributor

We will not need to modify anything in the DB besides the settings table... and given that if we change the path in the DB it will point to the same folder, it will not hurt.

@wasade
Copy link
Contributor

wasade commented Aug 25, 2015

@ElDeveloper, I think this is touching on the broader issue of path
canonicalization (removing all the .. from the paths, not just start or
end)

On Mon, Aug 24, 2015 at 8:35 PM, Jose Navas notifications@github.com
wrote:

We will not need to modify anything in the DB besides the settings
table... and given that if we change the path in the DB it will point to
the same folder, it will not hurt.


Reply to this email directly or view it on GitHub
#1439 (comment).

@ElDeveloper
Copy link
Contributor Author

@wasade, yeah that's what I meant.

@ElDeveloper
Copy link
Contributor Author

For some reason it works in an IPython session but when I call qiita-env patch the program just hangs, anyone has ideas as to why this may be happening?

@ElDeveloper
Copy link
Contributor Author

Ok, this should be ready for review, thanks for the help @josenavas!

@josenavas
Copy link
Contributor

👍

antgonza added a commit that referenced this pull request Aug 25, 2015
BUG: Fix problem with default basedir
@antgonza antgonza merged commit fb1737d into qiita-spots:master Aug 25, 2015
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 this pull request may close these issues.

4 participants