Skip to content

CP on a folder fails when not following symlinks #937

Description

@xastor

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

v10.15.3

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

master (9237f66 on Mar 6)

Operating system:

ElementaryOS 5 Juno (Ubuntu bionic based-

Description of the bug:

Copying a folder with symlinks disabled (cp -RP) , fails because it is trying to be copied as a file.

Example ShellJS command to reproduce the error:

pieter@officepib:~$ cd /tmp
pieter@officepib:/tmp$ mkdir TestFolder
pieter@officepib:/tmp$ touch TestFolder/bla
pieter@officepib:/tmp$ shx cp -P TestFolder TestFolder2
/usr/lib/node_modules/shx/node_modules/shelljs/src/common.js:399
        throw e;
        ^

ShellJSInternalError: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:493:3)
    at copyFileSync (/usr/lib/node_modules/shx/node_modules/shelljs/src/cp.js:70:22)
    at /usr/lib/node_modules/shx/node_modules/shelljs/src/cp.js:298:7
    at Array.forEach (<anonymous>)
    at _cp (/usr/lib/node_modules/shx/node_modules/shelljs/src/cp.js:243:11)
    at /usr/lib/node_modules/shx/node_modules/shelljs/src/common.js:384:25
    at shx (/usr/lib/node_modules/shx/lib/shx.js:139:37)
    at run (/usr/lib/node_modules/shx/lib/cli.js:20:31)
    at Object.<anonymous> (/usr/lib/node_modules/shx/lib/cli.js:39:3)
    at Module._compile (internal/modules/cjs/loader.js:701:30)

On cp.js:250 seems to only go into a directory when following symlinks is enabled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions