OokTech/TW5-Bob

Paths for plugins, themes, and editions are incorrect case on Linux

Closed this issue · 11 comments

Attempting to create a new TW5-Bob installation (without use of the executable, as I have a server I'm using through SSH) creates a server that immediately crashes because it can't find the editions folder. This is because the path is capitalized in the code, but lowercase in the actual folders - which is to say, because Linux is case-sensitive, it's not seeing the folders that are already there.

Bob is expecting ./Themes
Bob finds ./themes

This isn't a major problem until it reaches the editions folder, at which point the server crashes.

NodeSettings - Parsed raw settings.
TiddlyWiki version 5.1.21 with Bob version 1.7.0b1
Bob saver server running on 127.0.0.1:61192
Serving on 127.0.0.1:8080
(press ctrl-C to exit)
new connection
No Themes Folder /home/fiona/TW5-Bob/TiddlyWiki5/Themes
No Plugins Folder /home/fiona/TW5-Bob/TiddlyWiki5/Plugins
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/home/fiona/TW5-Bob/TiddlyWiki5/Editions'
    at Object.readdirSync (fs.js:790:3)
    at Object.exports.getEditionInfo ($:/core/modules/utils/edition-info.js:28:21)
    at Object.ServerSide.getViewableLanguagesList ($:/plugins/OokTech/Bob/ServerSide.js:779:35)
    at Object.exports.handler ($:/plugins/OokTech/Bob/ServerRoutes/get-status.js:35:41)
    at SimpleServer.requestHandler ($:/plugins/OokTech/Bob/commands/wsserver.js:156:15)
    at Server.emit (events.js:198:13)
    at parserOnIncoming (_http_server.js:691:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)

This happened following the installation exactly, as well as when omitting the --branch v5.1.21 command. Since TW5-BobEXE is currently broken on Linux, this means TW5 is currently nonfunctional on Linux out of the box.

I'll rename the folders manually, and see if there are any similar issues elsewhere in the code.


I am running (check any that apply, put an x inside the [ ] to check a box, like this: [x]):

  • Windows
  • OSX
  • Linux
  • Other

and using

  • The nodejs version
  • The single file executable

Before posting I read issue guidelines and:

  • I am using the newest version
  • The answer to my question isn't listed in the documentation or this isn't
    a question
  • This is not a duplicate issue
  • I have not done anything that required me to set acceptance to
    I Will Not Get Tech Support For This

Upon further investigation, after renaming the folders, the server fails to start entirely because it no longer recognizes the --wsserver command.

Error: Unknown command: wsserver

Editing the paths for plugins and themes in settings.json to be lowercase fixes this issue. (The path for Wikis, however, is capitalized because it was created in the process of installing Bob, so it doesn't need to be changed.)

  "wikisPath": "./Wikis",
  "pluginsPath": "./plugins",
  "themesPath": "./themes",
  "servingFiles": {}

Editions must also be specified manually; it's not configured in the standard settings.json, and it will otherwise throw an error because the default is capitalized.

  "editionsPath": "./editions",

Do so, and the server will work as intended.

I am looking into this, I am not sure what happened because I don't think I have changed anything that would affect this.

My normal development computer died recently so I have been using an old work laptop and my testing has suffered, so I expect there to be problems like this appearing. Thank you for the bug report.

This is more confusing now, the laptop I am working on has osx with a case sensitive file system so I am looking into why it isn't affecting me.

As a bit of explanation about why I am confused, the core plugins, themes, etc. are in subfolders of the TiddlyWiki5 folder and are all lowercase. Bob is set up so that you can have additional plugins in another location, the way that BobEXE is configured by default it creates the folders Plugins, Edition, Languages, etc. where third party plugins can be placed without causing trouble when updating to a new version of BobEXE.

The settings in settings.json are supposed to only affect the locations used by these additional folders, the default folders in the TiddlyWiki5 folder are set in boot.js and shouldn't be affected by Bob.

I am guessing that some part of that is wrong, I just haven't found it yet or why it isn't breaking for me. I will put it on one of the raspberry pis I have and see how that goes.

Thank you for the prompt reply. I'd say it could be on TW5's side, but it happens with both v5.1.21 and the current Git state. It also keeps failing on 1.6.2 as well. I'll try on my VPS when I'm done this post, to see if it works differently there; it's entirely possible that it's simply failing to create the folders when requested. Does Bob have any server-side dependencies?

It should be noted that I'm installing manually, not with TW5-BobEXE. If TW5-BobEXE creates its folders with the structure expected by the plugin, then that could account for the discrepancy - that is, if it's what you're using.

Indeed, I've used TW5-BobEXE to install, and the paths are capitalized as Plugins, Themes, Editions. It launches with no issues. (Also, you haven't added the prerelease to this repo!)

Very strange things are happening in any case - I can't enable the file server, for whatever reason. I click the check box, and the box is cleared. Neither editing settings.json (which shows the server as enabled!) nor the 'Manual Settings' box works, and the same thing happens in newly created wikis as well. Uploading files creates encoded tiddlers, trying to move the files to ./files fails and breaks the tiddlers, and trying to list existing files crashes the server.

$:/plugins/OokTech/Bob/NodeServerHandlers.js:1033
      wikiName = wikiName || '';
      ^

ReferenceError: wikiName is not defined
    at thisCallback ($:/plugins/OokTech/Bob/NodeServerHandlers.js:1033:7)
    at $:/plugins/OokTech/Bob/ServerSide.js:1031:13
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)

The file server still won't work regardless of version or install method. My server may be the culprit somehow, but I'll need the VPS to test.

Thank you for all your hard work, by the way - I'm really looking forward to the secure server option! It might help me with a project I'm working on.

EDIT: The same problems all happened on the VPS.

I have been testing TW5-Bob v1.6.2 and v1.7.1 on Arch Linux (PC) and Arch Linux ARM (Raspberry Pi). On all installations I have experienced the problems reported here.

Following the git clone installation instructions:

  1. When starting BobWiki for the first time the server stops:
[niggi@archbox TiddlyWiki5]$ node tiddlywiki.js Wikis/BobWiki/ --wsserver
NodeSettings - Parsed raw settings.
TiddlyWiki version 5.1.23 with Bob version 1.7.1
Bob saver server running on 127.0.0.1:61192
Serving on 127.0.0.1:8080
(press ctrl-C to exit)
new connection
No Themes Folder /home/niggi/projects/TiddlyWiki5/Themes
No Plugins Folder /home/niggi/projects/TiddlyWiki5/Plugins
node:internal/fs/utils:320
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/home/niggi/projects/TiddlyWiki5/Editions'
    at Object.readdirSync (node:fs:1044:3)
    at Object.exports.getEditionInfo ($:/core/modules/utils/edition-info.js:28:21)
    at Object.ServerSide.getViewableLanguagesList ($:/plugins/OokTech/Bob/ServerSide.js:781:35)
    at Object.exports.handler ($:/plugins/OokTech/Bob/ServerRoutes/get-status.js:35:41)
    at SimpleServer.requestHandler ($:/plugins/OokTech/Bob/commands/wsserver.js:262:15)
    at Server.emit (node:events:376:20)
    at parserOnIncoming (node:_http_server:907:12)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:126:17) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/home/niggi/projects/TiddlyWiki5/Editions'
}

The installation instructions are missing the detail of creating the required folders:

I suggest after cd TiddlyWiki5 add mkdir Editions Plugins Themes Languages. This sovles the problem:

[niggi@archbox TiddlyWiki5]$ node tiddlywiki.js Wikis/BobWiki/ --wsserver
NodeSettings - Parsed raw settings.
TiddlyWiki version 5.1.23 with Bob version 1.7.1
Bob saver server running on 127.0.0.1:61192
Serving on 127.0.0.1:8080
(press ctrl-C to exit)
new connection

I am running bob 1.7.2 manual install with tiddlywiki 5.1.23 and the problem still happens. As I am under linux with ext4 partitions, I opted for symbolic links to avoid the problem:

ln -s languages Languages
ln -s editions Editions
ln -s themes Themes
ln -s plugins Plugins

But then I discovered a problem with the langaguage support, as my setup was for French. This I will cover in an other issue.

@psiloi The new folders Languages, Editions, Themes, Plugins have nothing to do with languages, editions, themes, plugins. Therefore, don't link them together. Just create the new folders within your TiddlyWiki5 folder of your manual installation. The new folders allow you to serve your own or cloned Plugins, Themes, Editions, Languages to other Wikis created with Bob. It is a great way to install and update them only once, instead of doing it for every Wiki again and again.

@domalex is correct about the reason the folders exist. Only the Editions folder causes any trouble, the core function for finding editions throws an error if a folder it is looking for doesn't exist, the others handle folders missing without trouble.

I went back to using a custom function to look for editions and the problem should be fixed.

The other folders (with capital letters) are not supposed to be the same as the ones with lowercase letters, and they are configurable, so that part isn't a bug. The paths are described here