dominictarr / npmd

MIT License
450 stars 37 forks source link

EXDEV when moving temporary package folder #4

Closed tim-smart closed 11 years ago

tim-smart commented 11 years ago
$ npmd install request
request@2.21.0 -> /home/tim/node_modules

/home/tim/.local/lib/node_modules/npmd/index.js:85
      if(err) throw err
                    ^
Error: EXDEV, rename '/tmp/tim/13727359679500.3233381509780884/package'

To move files between partitions you will need to copy them using pipe etc. Maybe absorb EXDEV errors and fallback to copying in those cases; or allow the user to set the temporary directory which would be on the same partition.

dominictarr commented 11 years ago

hmm. interesting. the reason to move the file is to make it as atomic as possible, and fast. (performance is important for npmd, especially for high latency users in the antipodes ;)

If I knew that the /tmp was in a separate partition, then i'd be unpacking stuff somewhere else...

why do you have /tmp on a separate partition?

right now, I'm leaning towards having a configuration option for tmpdir...

tim-smart commented 11 years ago
$ uname -a
Linux tim-macbook-arch 3.9.8-1-ARCH #1 SMP PREEMPT Thu Jun 27 21:37:31 CEST 2013 x86_64 GNU/Linux
$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)

It must be an arch linux thing. A config option would be my choice too.

dominictarr commented 11 years ago

argh. I guess I'm gonna have to use a config option for this... it's gonna uglify some stuff, though...

dominictarr commented 11 years ago

okay, try npmd@0.3.0

npmd install request --tmp ~/.npmd-tmp

tim-smart commented 11 years ago

Can we have a config file? Otherwise:

$ npmd install request --tmp ~/.cache/npmd
request@2.21.0 -> /home/tim/node_modules
qs@0.6.5 -> /home/tim/node_modules/request/node_modules
json-stringify-safe@4.0.0 -> /home/tim/node_modules/request/node_modules
forever-agent@0.5.0 -> /home/tim/node_modules/request/node_modules
tunnel-agent@0.3.0 -> /home/tim/node_modules/request/node_modules
http-signature@0.9.11 -> /home/tim/node_modules/request/node_modules
hawk@0.13.1 -> /home/tim/node_modules/request/node_modules
aws-sign@0.3.0 -> /home/tim/node_modules/request/node_modules
oauth-sign@0.3.0 -> /home/tim/node_modules/request/node_modules
cookie-jar@0.3.0 -> /home/tim/node_modules/request/node_modules
node-uuid@1.4.0 -> /home/tim/node_modules/request/node_modules
mime@1.2.9 -> /home/tim/node_modules/request/node_modules
form-data@0.0.8 -> /home/tim/node_modules/request/node_modules
assert-plus@0.1.2 -> /home/tim/node_modules/request/node_modules/http-signature/node_modules
asn1@0.1.11 -> /home/tim/node_modules/request/node_modules/http-signature/node_modules
ctype@0.5.2 -> /home/tim/node_modules/request/node_modules/http-signature/node_modules
hoek@0.8.5 -> /home/tim/node_modules/request/node_modules/hawk/node_modules
boom@0.4.2 -> /home/tim/node_modules/request/node_modules/hawk/node_modules
cryptiles@0.2.1 -> /home/tim/node_modules/request/node_modules/hawk/node_modules
sntp@0.2.4 -> /home/tim/node_modules/request/node_modules/hawk/node_modules
combined-stream@0.0.4 -> /home/tim/node_modules/request/node_modules/form-data/node_modules
async@0.2.9 -> /home/tim/node_modules/request/node_modules/form-data/node_modules
hoek@0.9.1 -> /home/tim/node_modules/request/node_modules/hawk/node_modules/boom/node_modules
hoek@0.9.1 -> /home/tim/node_modules/request/node_modules/hawk/node_modules/sntp/node_modules
delayed-stream@0.0.5 -> /home/tim/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules

npmd install --tmp ~/tmp/npmd request 1.24s user 0.18s system 30% cpu 4.674 total

FYI npm uses ~/tmp

dominictarr commented 11 years ago

yes.

npmd uses https://npmjs.org/package/rc for config. which gets config from opts, envvar, or config files, in the most sensible places.

tim-smart commented 11 years ago

Yay! Thanks for this.