Quote:
Originally Posted by NiLuJe
That's a rather large hammer to hit an annoying nail with, but I haven't got any better idea ^^.
|
If you mean that literally, you can reduce the code to about 1/3rd of the size if you remove the config options and support for running on a non-kobo. If you mean the figuratively, I did look into using a patch (see the readme), using bind-mount trickery (too fragile, racy), using live syscall hooks (racy), shimming libnickel itself (would need to be linked with Qt, could break on updates, could miss things and cause unusual bugs), namespaces (not supported by the kernel version, would also require changing the boot script), a kernel module like GoboHide (it would be to dependent on the firmware), and this seemed to be the best option.
The only compatibility issues I see with this approach is if Kobo ever decides to use fdopendir (then we won't be able to see the full path to the dirents, only the names), and if Kobo needs to list another dotfile/dir under /mnt in a future update (but I think this is unlikely) (the dir won't appear, but kobo will still be able to list and access the files under it).
The advantages of this approach are that it persists (no chance of an update scanning those files by accident), it doesn't touch any pre-existing files (an update won't override it, it won't break anything else), it can limit itself to nickel only, it has complete control over what it shows/hides, it doesn't need to be updated with nickel, and it won't break anything if it a part of it is deleted (the config file or the library). The only time it'll break something enough to require a manual factory reset (it'll never require a sd reimage, unlike a kernel mod) is if there is a serious bug in the directory filtering code. This also turned out to be less brittle than I originally expected it to be, as I could limit it to nickel, it didn't need to pre-process all the dirents every time a dir was opened, and it didn't need to touch any existing files.
Quote:
That looks sound at first glance, but I'll take a closer look at it tomorrow .
|
Yep. Specifically, I'm not 100% certain I freed all allocated memory in all possible cases (specifically errors from the original functions), and I want a second pair of eyes to look at the dir matching and process checking logic (and also see if it covers everything and can't be made simpler). As for the dlsym and wrapper stuff, I'm pretty sure I did it right, although the readdir_r one was a bit unusual.
Also, if you have any ideas for the uninstall script, that'd be helpful (I already know about the self-deleting udev loop hook one, but I'm wondering if there's anything simpler).
P.S. I'm probably going to convert the gist into a full repo so I can do automatic builds and code comments on it.
P.P.S. FYI, the relevant libnickel symbol is SyncFileSystemCommand::findFilesToParse(QString const&, QStringList&)@0x575308, and the relevant Qt4 class is QDir.
Update: I've moved the code from the gist to a repo:
https://github.com/geek1011/kobo-mod...o-dotfile-hack.