dat
dat copied to clipboard
'dat create' throws permission error on Windows
OS: Windows 10 Pro 64-bit (10.0, Build 14393)
$ node -v
v8.9.0
$ dat -v
13.9.2
$ dat create
Welcome to dat program!
You can turn any folder on your computer into a Dat.
A Dat is a folder with some magic.
Your dat is ready!
We will walk you creating a 'dat.json' file.
(You can skip dat.json and get started now.)
Learn more about dat.json: https://github.com/datprotocol/dat.json
Ctrl+C to exit at any time
Title: foobar
Description:
{ Error: EPERM: operation not permitted, rename 'C:\Users\Sam\dat\dat.json.0.31154862242066184' -> 'C:\Users\Sam\dat\dat.json'
errno: -4048,
code: 'EPERM',
syscall: 'rename',
path: 'C:\\Users\\Sam\\dat\\dat.json.0.31154862242066184',
dest: 'C:\\Users\\Sam\\dat\\dat.json' }
$ ls -lah
total 30K
drwxr-xr-x 1 Sam 197121 0 Nov 4 16:36 .
drwxr-xr-x 1 Sam 197121 0 Nov 4 16:36 ..
drwxr-xr-x 1 Sam 197121 0 Nov 4 16:36 .dat
-rw-r--r-- 1 Sam 197121 23 Nov 4 16:36 dat.json
-rw-r--r-- 1 Sam 197121 129 Nov 4 16:36 dat.json.0.31154862242066184
The dest
file does get created, but the path
file is never removed.
Oh yeah windows has fun rules around renaming files.
Same problem here. In my case, although dat.json pops up, it misses properties. Interesting "rename".
$ type dat.json.0.8658656477487074
{ "title": "Title 001", "description": "Description 001", "url": "dat://blah-blah-blah" }
$ type dat.json
{ "title": "Title 001" }
Haven't quite had chance to dig into this. But error is something with toiletdb writing the temp file: https://github.com/maxogden/toiletdb/blob/master/index.js#L27
Oh this may be happening if dat.json
file already exists. And since toiletdb writes multiple times that would cause the missing properties.
Would it work if toiletdb was modified so that if the file exists, it deletes it before renaming the tmp file?
Should be fixed in Toiletdb, 1.4.1
. If someone with windows can reinstall Dat and test, that'd be great =).
I'll try to add a test to this before we close it.
Hi @joehand same error on Dat 13.10.0
on a Windows 10 installation. Seems like dat-json
needs to upgrade to toiletdb v1.4.1 and then updgrade dat
repo
Hi @joehand same error on Dat 13.10.0 on a Windows 10 installation. Seems like dat-json needs to upgrade to toiletdb v1.4.1 and then updgrade dat repo
Cool, I can package up the new dependency. Was hoping someone could test with a manual installation before I update that =).
Thanks.
Hi @joehand I have made a manual installation of Toiletdb on Dat and the error is still happening
Hmm is it still the same EPERM error?
A few other things that may help:
- Does it happen every time?
- Does it happen if you have a
dat.json
before runningdat create
? What if you do not have adat.json
file?
Hi @joehand, I updated to 13.10.0 and ran the original commands again. I'm getting the same results
Without a dat.json
$ dat create
Welcome to dat program!
You can turn any folder on your computer into a Dat.
A Dat is a folder with some magic.
Your dat is ready!
We will walk you through creating a 'dat.json' file.
(You can skip dat.json and get started now.)
Learn more about dat.json: https://github.com/datprotocol/dat.json
Ctrl+C to exit at any time
Title: foobar
Description:
{ Error: EPERM: operation not permitted, rename 'C:\Users\Sam\dat\dat.json.0.6578956869769148' -> 'C:\Users\Sam\dat\dat.json'
errno: -4048,
code: 'EPERM',
syscall: 'rename',
path: 'C:\\Users\\Sam\\dat\\dat.json.0.6578956869769148',
dest: 'C:\\Users\\Sam\\dat\\dat.json' }
With dat.json
$ dat create
Welcome to dat program!
You can turn any folder on your computer into a Dat.
A Dat is a folder with some magic.
Your dat is ready!
We will walk you through creating a 'dat.json' file.
(You can skip dat.json and get started now.)
Learn more about dat.json: https://github.com/datprotocol/dat.json
Ctrl+C to exit at any time
Title: (foobar)
Description:
{ Error: EPERM: operation not permitted, rename 'C:\Users\Sam\dat\dat.json.0.867297938747515' -> 'C:\Users\Sam\dat\dat.json'
errno: -4048,
code: 'EPERM',
syscall: 'rename',
path: 'C:\\Users\\Sam\\dat\\dat.json.0.867297938747515',
dest: 'C:\\Users\\Sam\\dat\\dat.json' }
$ ls -l
total 1
-rw-r--r-- 1 Sam 197121 129 Jan 29 01:39 dat.json.0.867297938747515
Hmmm, thanks @samuelmaddock. Looks like I need to dig into what exactly causes this a bit more.