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

dlt-daemon: Only create directories if they do not exist yet #340

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

alexmohr
Copy link
Contributor

dlt_mkdir_recursive runs mkdir for directories which already exist.
This fails if the directory already exists and the dlt-daemon
does not have the permissions to change the mode on the directory.
On many systems the directories are not created by dlt-daemon
itself but rather through the build system or while the
root filesystem is created.
At this stage the permissions are already set properly
and they might be less permissive than what dlt-daemon expects
but still sufficient.
For example is rwx not necessary for each directory in the tree.

Before this commit the following scenario would fail:

  • Path is set to /mnt/dlt/
  • mnt has 755 permissions for root
  • dlt has 755 for dlt user

As dlt daemon would try to run mkdir on /mnt
dlt_mkdir_recursive would fail due to lack of permissions
although the permissions are sufficient for dlt-daemon to
work and write its files into /mnt/dlt/
With this commit /mnt would not be created anymore because it
already exists.
If the permissions are not sufficient for dlt-daemon to write in
it will fail when trying to create files and exit at this point

The program was tested solely for our own use cases, which might differ from yours. Licensed under Mozilla Public License Version 2.0

Alexander Mohr, alexander.m.mohr@daimler.com, Daimler TSS GmbH, imprint

dlt_mkdir_recursive runs mkdir for directories which already exist.
This fails if the directory already exists and the dlt-daemon
does not have the permissions to change the mode on the directory.
On many systems the directories are not created by dlt-daemon
itself but rather through the build system or while the
root filesystem is created.
At this stage the permissions are already set properly
and they might be less permissive than what dlt-daemon expects
but still sufficient.
For example is rwx not necessary for each directory in the tree.

Before this commit the following scenario would fail:
* Path is set to /mnt/dlt/
* mnt has 755 permissions for root
* dlt has 755 for dlt user

As dlt daemon would try to run mkdir on /mnt
dlt_mkdir_recursive would fail due to lack of permissions
although the permissions are sufficient for dlt-daemon to
work and write its files into /mnt/dlt/
With this commit /mnt would not be created anymore because it
already exists.
If the permissions are not sufficient for dlt-daemon to write in
it will fail when trying to create files and exit at this point

Signed-off-by: Alexander Mohr <alexander.m.mohr@daimler.com>
@ssugiura ssugiura merged commit d2214ac into COVESA:master Oct 20, 2021
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.

None yet

2 participants