sideshowcoder / canned

Server to respond with fake API responses, by using a directory of files for finding out what to say!
213 stars 46 forks source link

Very long filename for regexmatchbug endpoint causes failed install #93

Closed wadtech closed 7 years ago

wadtech commented 8 years ago

I'm using ecryptfs on Ubuntu and when I install canned, the _regexmatchbug file pushes the filename length over the limit.

Since this file is there to cover a regression I'm loathe to get rid of it but I don't know what other approach I can take to mitigate the problem.

I've appended the npm error output for clarity.

Currently I've been installing it into /tmp with npm install canned then removing the regexmatchbug file and then moving the directory to my project node_modules.

npm ERR! tar.unpack untar error /home/peter/.npm/canned/0.3.7/package.tgz
npm WARN enoent ENOENT: no such file or directory, open '/home/peter/projects/package.json'
npm WARN projects No description
npm WARN projects No repository field.
npm WARN projects No README data
npm WARN projects No license field.
npm ERR! Linux 4.2.0-25-generic
npm ERR! argv "/home/peter/.nvm/versions/node/v4.2.4/bin/node" "/home/peter/.nvm/versions/node/v4.2.4/bin/npm" "install" "canned"
npm ERR! node v4.2.4
npm ERR! npm  v3.5.3
npm ERR! path /home/peter/projects/node_modules/.staging/canned-55c23294/spec/test_responses/_regexmatchbug?u=root&p=root&q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null).get.json
npm ERR! code ENAMETOOLONG
npm ERR! errno -36
npm ERR! syscall open

npm ERR! ENAMETOOLONG: name too long, open '/home/peter/projects/node_modules/.staging/canned-55c23294/spec/test_responses/_regexmatchbug?u=root&p=root&q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null).get.json'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/peter/projects/npm-debug.log
sideshowcoder commented 8 years ago

Ugh... that is not nice, could you check how far over the limit it is? would shortenting the filename help? Otherwise an option would be to move the test to use a file with the params in the file for matching not in the file name, basically doing a multi response file. What do you think?

wadtech commented 8 years ago

/home/peter/projects/node_modules/.staging/canned-55c23294/spec/test_responses/_regexmatchbug?u=root&p=root&q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null).get.json comes in at a weighty 290 characters. The limit for ext4 is 255 I believe.

I think there's something ecryptfs is doing specifically to do with encrypting filenames that makes it unusable.

A file that dynamically builds that test would mitigate it best I think, I can install canned if I do it in /tmp or somewhere that has a short enough path.

It's the nature of the project, being file-based, that the tests would need to encompass some of these things. I'll have a think about what might make it a bit easier.

sideshowcoder commented 7 years ago

I think since the matching on file names for get parameters is deprecated now anyway, and it really does not work well on Windows for example I think we can close this and just move this test to use multiresponses in one file in the future.