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

Chmod errors on startup because of topic names with spaces #22

Closed
Miroka96 opened this issue Dec 25, 2020 · 2 comments · Fixed by #23
Closed

Chmod errors on startup because of topic names with spaces #22

Miroka96 opened this issue Dec 25, 2020 · 2 comments · Fixed by #23

Comments

@Miroka96
Copy link
Contributor

Hello!

In my docker logs I came across errors of the following style:

chmod: cannot access '/var/www/grav/user/pages/08.kochbuch/Das': No such file or directory
chmod: cannot access 'mittelgro'$'\303\237''e': No such file or directory

This error is caused by xargs's interpretation of its command line input:
find /var/www/grav -type f | xargs chmod 664 should be find /var/www/grav -type f | xargs -d '\n' chmod 664, so xargs splits its input at linebreaks and not at spaces.

You can see the difference in the following tests:

$ find /home/mirko/test | xargs ls -lisah
ls: cannot access '/home/mirko/test/Hello': No such file or directory
ls: cannot access 'and': No such file or directory
ls: cannot access 'Welcome': No such file or directory
ls: cannot access '/home/mirko/test/sdf': No such file or directory
ls: cannot access 'sd': No such file or directory
ls: cannot access 'fs': No such file or directory
ls: cannot access 'ds': No such file or directory
ls: cannot access 'ds': No such file or directory
ls: cannot access 'sda': No such file or directory
ls: cannot access 'as': No such file or directory
/home/mirko/test:
total 20K
3801135 4.0K drwxrwxr-x  5 mirko mirko 4.0K Dec 25 13:12  .
3145730 4.0K drwxr-xr-x 62 mirko mirko 4.0K Dec 25 13:11  ..
3801136 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:11 'Hello and Welcome'
3803540 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:12 'sdf  sd fs ds ds sda as'
3801163 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:12  test

/home/mirko/test/test:
total 8.0K
3801163 4.0K drwxrwxr-x 2 mirko mirko 4.0K Dec 25 13:12 .
3801135 4.0K drwxrwxr-x 5 mirko mirko 4.0K Dec 25 13:12 ..
$ find /home/mirko/test | xargs -d '\n' ls -lisah
/home/mirko/test:
total 20K
3801135 4.0K drwxrwxr-x  5 mirko mirko 4.0K Dec 25 13:12  .
3145730 4.0K drwxr-xr-x 62 mirko mirko 4.0K Dec 25 13:11  ..
3801136 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:11 'Hello and Welcome'
3803540 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:12 'sdf  sd fs ds ds sda as'
3801163 4.0K drwxrwxr-x  2 mirko mirko 4.0K Dec 25 13:12  test

'/home/mirko/test/Hello and Welcome':
total 8.0K
3801136 4.0K drwxrwxr-x 2 mirko mirko 4.0K Dec 25 13:11 .
3801135 4.0K drwxrwxr-x 5 mirko mirko 4.0K Dec 25 13:12 ..

'/home/mirko/test/sdf  sd fs ds ds sda as':
total 8.0K
3803540 4.0K drwxrwxr-x 2 mirko mirko 4.0K Dec 25 13:12 .
3801135 4.0K drwxrwxr-x 5 mirko mirko 4.0K Dec 25 13:12 ..

/home/mirko/test/test:
total 8.0K
3801163 4.0K drwxrwxr-x 2 mirko mirko 4.0K Dec 25 13:12 .
3801135 4.0K drwxrwxr-x 5 mirko mirko 4.0K Dec 25 13:12 ..

Best regards,
Miroka

@dsavell
Copy link
Owner

dsavell commented Jan 2, 2021

Hey @Miroka96 happy new year!

Good spot I must admit I have always avoided the usage of empty spaces in file/folder/page names, linux habbit.

Intresting though, I am now thinking does this only need to be a one off (first time container starts), depends how your creating pages?

Scenario 1: create page from outside container then start container then it would make sense to run permissions everytime it starts.
Scenario 2: create page using admin panel, therefor it should be the grav user that would auto set to the correct permission anyway.

@dsavell
Copy link
Owner

dsavell commented Jan 2, 2021

Merged current fix, however new issue is open based on my comment #26

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 a pull request may close this issue.

2 participants