pylon icon indicating copy to clipboard operation
pylon copied to clipboard

`find` command uses GNUisms, causing issues in FreeBSD (& presumably other non-Linux OSes)

Open darkuranium opened this issue 11 months ago • 4 comments

I ran into this issue while running Pylon in FreeBSD:

Process terminated with code 1, find: illegal option -- O

I couldn't narrow down the root cause upon a (somewhat) quick check, and fortunately, a workaround exists (install gfind, and then ln -s /usr/local/bin/gfind ~/.local/bin/find).

Still, I figured I might as well bring this up.

darkuranium avatar Jan 09 '25 13:01 darkuranium

in which line is this executed?

Kreijstal avatar Jan 10 '25 11:01 Kreijstal

That's the part I couldn't find. But since you seem interested, I can try giving it another go.

Seems to happen when the client connects.

darkuranium avatar Jan 10 '25 11:01 darkuranium

what does git grep says?

Kreijstal avatar Jan 10 '25 12:01 Kreijstal

FOUND IT!

https://github.com/pylonide/pylon/blob/master/plugins-server/pylon.ide.filelist/filelist.js#L91

Note that FreeBSD also has the -E option for find, so you can also add that platform to the list.

A more reliable way might be to run find --version --- gfind will yield a result, whereas FreeBSD's will error out. Not sure about Darwin's, but even if it doesn't error out, you should be able to parse the version.

Or --- this is hacky, but should be even more reliable --- you use something akin to find -O3 $APPDIR/test (replace $APPDIR/test with any nearly-empty[^1] directory, in this case, you'd probably make it in JS anyway) ... any errors here means it's either not GNU Find, or the system is horribly broken anyway.

[^1]: Nearly-empty for performance reasons; it otherwise technically doesn't matter, as long as find doesn't run into any "permission denied" problems or such.

darkuranium avatar Jan 10 '25 14:01 darkuranium