yatima1460 / Drill

Search files without indexing, but fast crawling
https://drill.software/
GNU General Public License v2.0
268 stars 21 forks source link

having a /snap folder seems to cause issues. #7

Closed RustyRaptor closed 5 years ago

RustyRaptor commented 5 years ago

Linux distro Kubuntu 18.04 LTS

Runtime type Pythone

Describe the bug Console spams error codes like this.

[Errno 2] No such file or directory: '/snap/some/snap/folder'

To Reproduce Steps to reproduce the behavior: run it whilst also having a /snap directory generated by the snap package manager

Expected behavior Not to be spammed with errors. Screenshots

[Errno 40] Too many levels of symbolic links: '/snap/slack/12/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11'
Thread for "/snap/slack/12" finished its job
[Errno 40] Too many levels of symbolic links: '/snap/slack/13/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11'
Thread for "/snap/slack/13" finished its job
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/apps/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/apps/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/apps@2/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/apps@2/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/ghostscript/9.26/Resource/CIDFSubst/DroidSansFallback.ttf'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/status/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/status@2/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock@2/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock@2/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/Humanity/stock@2/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/apps/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/apps/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/apps@2/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/apps/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/apps@2/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/apps/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/apps@2/24/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/apps@2/48/catfish.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/ubuntu-mono-dark/status/22/gpm-primary-000-charging.svg'
[Errno 2] No such file or directory: '/snap/gimp/113/usr/share/icons/ubuntu-mono-dark/status/24/gpm-primary-000-charging.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/status/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/status@2/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/status/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock@2/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock@2/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/Humanity/stock@2/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/status@2/48/aptdaemon-update-cache.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock@2/22/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock@2/24/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/Humanity/stock@2/48/stock_zoom-page.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/ubuntu-mono-dark/status/22/gpm-primary-000-charging.svg'
[Errno 2] No such file or directory: '/snap/gimp/130/usr/share/icons/ubuntu-mono-dark/status/24/gpm-primary-000-charging.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/ubuntu-mono-dark/status/22/gpm-primary-000-charging.svg'
[Errno 2] No such file or directory: '/snap/gimp/165/usr/share/icons/ubuntu-mono-dark/status/24/gpm-primary-000-charging.svg'
[Errno 40] Too many levels of symbolic links: '/snap/gimp/113/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/circo'
[Errno 40] Too many levels of symbolic links: '/snap/gimp/113/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11'
Thread for "/snap/gimp/113" finished its job
[Errno 40] Too many levels of symbolic links: '/snap/gimp/130/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/circo'
[Errno 40] Too many levels of symbolic links: '/snap/gimp/130/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11'
Thread for "/snap/gimp/130" finished its job
[Errno 40] Too many levels of symbolic links: '/snap/gimp/165/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/circo'
[Errno 40] Too many levels of symbolic links: '/snap/gimp/165/usr/bin/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11'
Thread for "/snap/gimp/165" finished its job

Other notes searching in /snap is probably a bad idea. It's like searching node modules but worse.

RustyRaptor commented 5 years ago

Ok I see that there is actually an if statement in the program that explicitly ignores snap. So something is off here. When I add /snap to bad paths though it stops.

RustyRaptor commented 5 years ago

Oh ok so the problem is it is assuming snap is in /home which isn't the case.

RustyRaptor commented 5 years ago

Ok so I fixed the issue with snap however now I am finding an even greater problem. the direntry_ok function is never returning true. I wonder what's causing this. When I don't have the snap ignore stuff in it only searches in /snap. This is so weird.

RustyRaptor commented 5 years ago

hmm it seems that it's iterating over all the mount points to run Crawl() but it never seems to run crawl in the root directory or just in /home.

Is this normal behavior or am I missing something obvious? I managed to fix it by creating a craw instance with /home right after that for loop.

      for mountpoint in mountpoints:
            print("Starting thread for: ", mountpoints)
            exclusion_list = mountpoints[:]
            exclusion_list.remove(mountpoint)
            t = Crawler(mountpoint,self.index,excludes=exclusion_list)

            t.start()
            self.threads.append(t)

        r = Crawler("/home", self.index)
        r.start()
        self.threads.append(r)
RustyRaptor commented 5 years ago

Is it ok/normal to discuss this in this issue or should I move this elsewhere.

RustyRaptor commented 5 years ago

Moved home folder issue to #9

yatima1460 commented 5 years ago

??? snap seems to have symbolic links that point to themselves inside itself

who the f*ck designed this

I need to add something to prevent filesystem loops

AngelsDustz commented 5 years ago

Maybe add X levels of recursion check, I think that's how most programs solve it set it to like 4/5 at base if it goes over stop.

yatima1460 commented 5 years ago

Switched to D and rewritten the crawling system, let me know if this still happens

yatima1460 commented 5 years ago

Fixed because now I don't follow the symlinks anymore

It's pointless to follow them, I can find all the files anyway and using symlinks could create problems related to a crawler going from one disk to another