Comments (15)
Add the "-Debug" option to the command:
jsish -a jsi-app.fossil Ledger -Debug 1
from jsish.
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.
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.
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.
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.
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.
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.
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.
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:
from jsish.
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.
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.
Yes! That works. Thank you. I used the jsish.org binary as I don't have a C build system yet.
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.
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.
OK, I've commited a fix, if you'd like to download the jsish.exe and try it out.
from jsish.
+1 it works. Thank you
from jsish.
Related Issues (20)
- heap-buffer-overflow in ./jsish/src/jsiUtils.c
- heap-use-after-free ./jsish/src/jsiUtils.c:2060:17 in SplitChar
- heap-use-after-free src/jsiObj.c:672 in jsi_ObjNewObj
- MEMLEAK NOW: Heap-use-after-free src/jsiObj.c:339 in Jsi_ObjFree HOT 2
- Heap-use-after-free src/jsiUserObj.c:32 in jsi_UserObjDelete
- Heap-use-after-free src/jsiFunc.c:207 in jsi_ArgTypeCheck HOT 2
- Heap-use-after-free src/jsiArray.c:958 in SortSubCmd
- Heap-use-after-free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5166d)
- Heap-use-after-free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732)
- Which ECMAscript standrd does Jsish Support HOT 1
- Use-after-free in Jsi_ObjFree (Jsi_ObjFree src/jsiObj.c:342) HOT 1
- incomplete creation for RegExp object
- Type confusion in jsValue.c
- Fail to throw a Type Error
- Integer overflow in jsiEvalCodeSub (src/jsiEval.c:1363)
- Integer overflow in jsiEvalCodeSub (src/jsiEval.c:1745)
- Grammar railroad diagram HOT 3
- SEGV on unknown address in jsiEvalCodeSub
- stack-overflow ./jsish/src/jsiValue.c:1451 in IterGetKeysCallback
- heap-use-after-free ./jsish/src/jsiValue.c:41:5 in Jsi_DecrRefCount HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsish.