Skip to content

bug: cp() doesn't always copy everything #547

@nfischer

Description

@nfischer

Node version (or tell us if you're using electron or some other framework):

v6.7.0 (probably any version though)

ShellJS version (the most recent version/Github branch you see the bug on):

Tested this on 0.7, but it's probably the case on master still, since we haven't touched the code in a while.

Operating system:

Ubuntu (but the bug was originally observed on OS X in shelljs/shx#94).

Description of the bug:

This was originally filed as shelljs/shx#94. It's not specific to shx though, so I'm moving it upstream. I don't think this has to do with 72 being a hard limit on cp(), but I think there must be some bug that's causing us to exit early while processing long lists, or perhaps just for processing lots of data.

Although shelljs is missing some files, it consistently misses the same files each time I re-run the command (so I don't think it's a race condition).

Example ShellJS command to reproduce the error:

Using this zip as the node_modules folder in the example:

shell.cp('-r', 'node_modules', 'otherModules');
$ diff -r node_modules/ otherModules/ # observe that otherModules/ is missing some directories

Interestingly, if I run this command, I don't see any significant issues:

shell.cp('-r', 'otherModules', 'otherModules2'); // copying the copy seems to get all the files

Metadata

Metadata

Assignees

Labels

fixBug/defect, or a fix for such a problemmedium priority

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions