Git Product home page Git Product logo

Comments (15)

pcmacdon avatar pcmacdon commented on July 2, 2024 1

Add the "-Debug" option to the command:

jsish -a jsi-app.fossil Ledger -Debug 1

from jsish.

pcmacdon avatar pcmacdon commented on July 2, 2024 1

There was code in Jsi_NormalPath to handle this case, but it was commented out. If there was a reason why, I can not remember. So I've uncommented it. Can you rebuild and give it a retry? I've also rebuilt the windows download: http://jsish.org/bin/jsish.exe

from jsish.

maphew avatar maphew commented on July 2, 2024

Relatedly, the online demos (https://docs.jsish.org/Demos.md#online) yield 502 Bad Gateway error. I'm happy to log that as a distinct issue if you'd prefer things broken out into distinct items. (I don't want to create too much noise while I'm still in exploration phase and not sure if this project matches my project enough to also stay around help fix things.)

from jsish.

maphew avatar maphew commented on July 2, 2024

I tried opening the fossil repo and setting jsi-app\Ledger\Ledger.jsi line defaultDBFile: to various relative and absolute paths but that didn't work. Jsish always prepends the current path to the defaultDBFile path. For example:

defaultDbFile:'C:/Users/mhwilkie/code/LedgerJsi/ledgerjs.db',
C:\> jsish "C:\Users\mhwilkie\code\jsi-app\Ledger\Ledger.jsi"
error: File open failed 'C:/C:/Users/mhwilkie/code/jsi-app/Ledger/Ledger.jsi'
ERROR:

I also tried running from mingw bash shell with the original default path of ~/LedgerJsi/Ledgerjs.db but same error.

from jsish.

pcmacdon avatar pcmacdon commented on July 2, 2024

Re: 502
I just visited https://docs.jsish.org/Demos.md#online and saw no problem.
Could this just be a transient network problem?

from jsish.

pcmacdon avatar pcmacdon commented on July 2, 2024

Hi and thanks for the bug reports.
Jsish windows support is rudimentary at best, and it is easy to make it fail.
In this case, you hit the nail on the head. It seems HOMEDRIVE is the source of the problem in the "realpath()" call because it is expected to be a drive letter "C:", but looks to be a path instead. You could verify by commenting it out at Ledger.jsi:1590: eg:

# self.dbfile = File.realpath(self.dbfile);

from jsish.

maphew avatar maphew commented on July 2, 2024

Well we have progress! After commenting out line 1590 it get's past the default db setup and launches a browser. It's not working yet but I have a trail to follow through the thorn patch. I've spent a lot of hours learning how to handle cross platform paths in Python so once I get a handle on the Js(i) view of the world I might be able to help solidify these parts.

Matt@SERVER D:\Matt\code\jsi\jsi-app
$ jsish Ledger\Ledger.jsi
Ledger.jsi:169:  "WARN: Updating DB schema version from 0", createDb()
CALL BACKTRACE:
#1: Ledger.jsi:16:  in moduleRun()
#2: Ledger.jsi:1696:  in Ledger( [], {} )
#3: Ledger.jsi:1690:  in main()

D:/Matt/code/jsi/jsi-app/Ledger/Ledger.jsi:1690: error: JSON parse error (unexpected symbol) at offset 1 ""D:/\Matt\code\jsi\jsi-app/D:/"
Ledger.jsi:1220: "WARN: fossil not found", FossilBackup()

from jsish.

maphew avatar maphew commented on July 2, 2024

How to see the LogDebug messages? e.g. I tried adding a couple of lines to report what's going on but they're not being echoed to the starting shell. (Feel free to direct me elsewhere if this is too basic a question for here. I am learning how to use the web debugger (so cool!) but that hasn't revealed anything to me yet.)

Starting at line Ledger.jsi:1588

        if (self.dbfile === '' || self.dbfile === undefined)
            self.dbfile = self.defaultDbFile;
            LogDebug("self.dbfile Before:" + self.dbfile);        
            self.dbfile = File.realpath(self.dbfile);
        LogDebug("self.dbfile: After" + self.dbfile);

from jsish.

maphew avatar maphew commented on July 2, 2024

It's not the realpath() line. Debug shows createDb is using a correctly formed Windows path. It looks like it's the Sqlite() call that's prepending current dir.

$ jsish Ledger\Ledger.jsi -Debug 1
Ledger.jsi:1591: "DEBUG: self.dbfile Before: ~/LedgerJsi/ledgerjs.db", main()
Ledger.jsi:1593: "DEBUG: self.dbfile: After: C:/Users/mhwilkie/LedgerJsi/ledgerjs.db", main()
Ledger.jsi:1599: "DEBUG: using db file: C:/Users/mhwilkie/LedgerJsi/ledgerjs.db", main()
Ledger.jsi:131:  "DEBUG: CreateDb:fd: C:/Users/mhwilkie/LedgerJsi", createDb()
CALL BACKTRACE:
#1: Ledger.jsi:16:  in moduleRun( "-Debug", "1" )
#2: Ledger.jsi:1699:  in Ledger( [], { Debug:1 } )
#3: Ledger.jsi:1600:  in main()
#4: Ledger.jsi:134:  in createDb( 0, "C:/Users/mhwilkie/LedgerJsi/ledgerjs.db" )

Ledger.jsi:134: error: db open failed: C:\Users\mhwilkie\code\jsi-app/C:/Users/mhwilkie/LedgerJsi/ledgerjs.db    (c-extn [Sqlite])
ERROR:

ledger-debug-path.txt

from jsish.

pcmacdon avatar pcmacdon commented on July 2, 2024

Ah, I was misled by your statement about HOMEPATH etc.
Yes, it looks like the culprit in this case is jsiSqlite.c call to Jsi_ValueNormal,
which leads to Jsi_NormalPath in jsiFilesys.c:1204, which is unable to handle Windows drive letter madness as indicated by the comment:

// TODO: add proper handling for windows paths.

Path normalization is particularly difficult. Will have to look at it tomorrow.

from jsish.

maphew avatar maphew commented on July 2, 2024

thank you for the attention; I imagine you had other designs on your focus today! In my attempts to wrest my brain into sense making I landed in the same file, but was spelunking in Jsi_FileRealpathStr() instead. I still don't understand C, but the gist is far clearer to me than it was a few years ago. Likely you don't need it, but in case it's helpful: my searching led to python's posixpath lib as a battle tested help with the logic (by way of Roman Susi).

from jsish.

maphew avatar maphew commented on July 2, 2024

Yes! That works. Thank you. I used the jsish.org binary as I don't have a C build system yet.

image

A niggle: there's mistaken a message about not being in current checkout. Maybe that has something to do with why the section was commented out.

Matt@SERVER D:\Matt\code\jsi\jsi-app
$ fossil sync
Sync with https://jsish.org/fossil/jsiapp/
Round-trips: 1   Artifacts sent: 0  received: 0
Sync done, wire bytes sent: 1897  received: 1934  ip: 50.116.0.90

Matt@SERVER D:\Matt\code\jsi\jsi-app
$ jsish Ledger\Ledger.jsi
Ledger.jsi:169:  "WARN: Updating DB schema version from 0", createDb()
current directory is not within an open checkout
current directory is not within an open checkout

btw, very nice touch that jsi exits when the browser window closes. I've not seen any other local web server app do that.

from jsish.

maphew avatar maphew commented on July 2, 2024

Relative path works but not absolute. I can work around this, it doesn't block me, but now is noted as current limitation.

$ jsish -v
3.5.0 3.05 f6e85cbd1fdeb58afeac16c7c68a61b1e260c2d9 2021-09-14 14:17:34 UTC

Matt@SERVER D:\Matt\www\maphew.com-fossil\ckout
$ jsish %cd%\make-index.jsi -Debug 1
error: File open failed 'D:/Matt/www/maphew.com-fossil/ckout/D:/Matt/www/maphew.com-fossil/ckout/make-index.jsi'
ERROR:

Matt@SERVER D:\Matt\www\maphew.com-fossil\ckout
$ jsish .\make-index.jsi -Debug 1
[ "blog/About_Maphew.md", "blog/Batch/call-ss64-com-for-help.md" ...snip... ]

Where make-index.jsi is just:

var docs = File.glob('*.md', {recurse:true});
puts(docs);

from jsish.

pcmacdon avatar pcmacdon commented on July 2, 2024

OK, I've commited a fix, if you'd like to download the jsish.exe and try it out.

from jsish.

maphew avatar maphew commented on July 2, 2024

+1 it works. Thank you

from jsish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.