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

cro run attempts to read all directories on start and fails when lacking privileges #128

Open
camstuart opened this issue Sep 14, 2020 · 1 comment

Comments

@camstuart
Copy link

Hi,

I am using a docker-compose.yml to start up postgres in my Cro application with the data directory mounted in the top level of my project.

But because the directory is created by docker, it is not readable to the user launching cro run. Oddly, cro run seems to be attempting to scan all directories, and when it hits this one, it fails.

You can replicate this very easily in an existing Cro project like so:

sudo mkdir foo
sudo chmod -R 600 foo
cro run

Exception:

A react block:
  in sub run-services at /home/cam/rakudo/share/perl6/site/sources/2F5DE0083923025BCEC5898DAEB588F0A0CEBDC3 (Cro::Tools::CLI) line 227
  in sub MAIN at /home/cam/rakudo/share/perl6/site/sources/2F5DE0083923025BCEC5898DAEB588F0A0CEBDC3 (Cro::Tools::CLI) line 199
  in block <unit> at /home/cam/rakudo/share/perl6/site/resources/31DFBB60DDF0B7CC0994DED3586AF43BA050D249 line 1
  in sub MAIN at /home/cam/rakudo/share/perl6/site/bin/cro line 3
  in block <unit> at /home/cam/rakudo/share/perl6/site/bin/cro line 1

Died because of the exception:
    Failed to get the directory contents of '/home/cam/dev/github.com/camstuart/raku-cro-realworld-example-api-app/foo': Failed to open dir: Permission denied
      in sub run-services at /home/cam/rakudo/share/perl6/site/sources/2F5DE0083923025BCEC5898DAEB588F0A0CEBDC3 (Cro::Tools::CLI) line 227
      in sub MAIN at /home/cam/rakudo/share/perl6/site/sources/2F5DE0083923025BCEC5898DAEB588F0A0CEBDC3 (Cro::Tools::CLI) line 199
      in block <unit> at /home/cam/rakudo/share/perl6/site/resources/31DFBB60DDF0B7CC0994DED3586AF43BA050D249 line 1
      in sub MAIN at /home/cam/rakudo/share/perl6/site/bin/cro line 3
      in block <unit> at /home/cam/rakudo/share/perl6/site/bin/cro line 1

Is there perhaps a way of telling cro run to ignore a given directory?

@camstuart
Copy link
Author

I was able to get out of trouble by prefixing the directory with a . which are ignored.
However, using the .cro.yml file and specifying the ignore locations did not seem to work:

ignore:
  - foo/

I wonder if a file stat just after:
https://github.com/croservices/cro/blob/master/lib/Cro/Tools/Services.pm6#L43
and check for readable permissions, or skip would help? not sure how much that might slow the file watcher?

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

No branches or pull requests

1 participant