Skip to content

Strange behavior with directory permissions #123

Closed
LadyK-21/node-tar
#4
@patrickdawson

Description

@patrickdawson

I have the following file structure:

app
|--zipme
|   |--data (mode 777)
|   |   |--foo.txt (mode 777)

If I ran the follwing code

"use strict";

const tar = require("tar");

tar.c({
    gzip: true,
    file: "arch.tgz",
}, ["zipme"])
.then(() => tar.x({
    cwd: "x",
    file: "arch.tgz",
}))
.then(() => console.log("done!"))
    .catch(err => console.log(err));

the directory x/zipme/data has the mode 755 (probably because of the process umask).
When I run this code again without deleting the output dir (x/zipme) then the data directory gets the mode 777. Is this indented?
I expected the mode of the directory to be mode 777 the first time I run this code.

The same is not true for files. The mode stays unchanged on 755 regardless of how often I run this code.

Is there a way to have the modes of the tar source replicated in the output directory without changing the umask of the process?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions