Skip to content

Initialize root_directory setting with absolute path#12

Merged
aburgm merged 1 commit intogobby:masterfrom
hph86:rel-path-root
Mar 22, 2016
Merged

Initialize root_directory setting with absolute path#12
aburgm merged 1 commit intogobby:masterfrom
hph86:rel-path-root

Conversation

@hph86
Copy link
Copy Markdown
Contributor

@hph86 hph86 commented Mar 16, 2016

When starting infinoted twice like this

$ ./infinoted-0.7 --root-directory=data --security-policy=no-tls

a warning is emitted and infinoted becomes unusable:

Wed 16 Mar 2016 06:12:15 PM CET] WARNING: Failed to read the ACL for the root node: The pathname 'data/global-acl.xml' is not an absolute path
In order not to compromise security all permissions have been revoked for all users. The infinote server is likely not very usable in this configuration, so please check the storage system, fix the problem and re-start the server.

The ACL file global-acl.xml which is created during first invocation cannot be read during second invocation. The cause seems to be the function infd_filesystem_storage_storage_read_acl().

First, infd_filesystem_storage_get_acl_path() -> infd_filesystem_storage_get_path() is called and it should assure (according to the documentation) to always return an absolute path to said file. However, it only returns an absolute path if the "root-directory" setting was already absolute. Then, infd_filesystem_storage_read_xml_file_impl() -> g_filename_to_uri() is called which expects an absolute path and fails otherwise.

The PR should ensure that priv->root_directory is always initialized with an absolute path. Thus, both relative and absolute settings of --root-directory should now be handled correctly.

@hph86 hph86 changed the title handle relative path to root directory correctly Handle relative path to root directory correctly Mar 17, 2016
@tyll
Copy link
Copy Markdown
Contributor

tyll commented Mar 18, 2016

#14 should fix the travis-ci here as well

@aburgm
Copy link
Copy Markdown
Contributor

aburgm commented Mar 19, 2016

It seems dangerous to query the current directory every time a path is resolved, because the current directory could change during the lifetime of the program. I'd prefer to ensure that priv->root_directory is absolute at construction time.

@hph86
Copy link
Copy Markdown
Contributor Author

hph86 commented Mar 19, 2016

Good point I did not think of. Hopefully, I'll find time to rewrite the PR today.

@hph86 hph86 changed the title Handle relative path to root directory correctly Initialize root_directory setting with absolute path Mar 20, 2016
@hph86
Copy link
Copy Markdown
Contributor Author

hph86 commented Mar 20, 2016

@aburgm: I have just updated the PR according to your suggestion.

@tyll
Copy link
Copy Markdown
Contributor

tyll commented Mar 21, 2016

travis-ci is unhappy, because it could not access the Ubuntu mirror, which is unrelated to this change. Can the check be re-started?

@aburgm
Copy link
Copy Markdown
Contributor

aburgm commented Mar 21, 2016

I restarted the job and it looks good. Will merge it tonight, hopefully.

@aburgm aburgm merged commit ebe18aa into gobby:master Mar 22, 2016
@aburgm
Copy link
Copy Markdown
Contributor

aburgm commented Mar 22, 2016

Thanks!

@hph86 hph86 deleted the rel-path-root branch March 22, 2016 06:56
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.

3 participants