@poe-platform/safe-bash 0.1.802 → 0.1.803
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/image-ast/index.browser.js +13 -4
- package/dist/image-ast/index.js +13 -4
- package/dist/safe-bash/chunks/{chunk-KDNSPLII.js → chunk-2LSAMQER.js} +1 -0
- package/dist/safe-bash/chunks/{chunk-NZQXYWA3.js → chunk-5OHX7C2V.js} +0 -1
- package/dist/safe-bash/chunks/{chunk-SHEMU2Z7.js → chunk-B7PIL77G.js} +82 -63
- package/dist/safe-bash/chunks/{chunk-WDLGKIHD.js → chunk-EEEWOYEG.js} +4 -4
- package/dist/safe-bash/chunks/{chunk-GETUOD5D.js → chunk-GDYNCWRV.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-RSTHLAF3.js → chunk-JMMEIDPF.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-44ALJ4QG.js → chunk-PNBBUWSM.js} +71 -55
- package/dist/safe-bash/chunks/{chunk-NQCM3TYR.js → chunk-RYFQ3LZG.js} +73 -44
- package/dist/safe-bash/chunks/chunk-VBTDHOWC.js +55 -0
- package/dist/safe-bash/command-chunks/{chunk-ORYGZYKW.js → chunk-4FEVBOL5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VXSLJH7G.js → chunk-6JSIFWYT.js} +26 -6
- package/dist/safe-bash/command-chunks/chunk-A7MU7762.js +200 -0
- package/dist/safe-bash/command-chunks/{chunk-KJIMDLBB.js → chunk-BXCXRYVU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-F4TEEZTL.js → chunk-CQHP3I66.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PEF7K3UQ.js → chunk-EARHPPPJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QKFSRZGQ.js → chunk-GFC2NTDG.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-GIRNFXP3.js +466 -0
- package/dist/safe-bash/command-chunks/{chunk-FPVUD6TH.js → chunk-HDCNKOIX.js} +9 -7
- package/dist/safe-bash/command-chunks/{chunk-MQFIPHIQ.js → chunk-ILX2NOLF.js} +18 -15
- package/dist/safe-bash/command-chunks/{chunk-5E4WAO4O.js → chunk-JD5QNRNO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-I237SNW5.js → chunk-LFJJQQND.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-W5DNF4JH.js → chunk-LOICUCHG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7U7EXOXX.js → chunk-NASVPT6F.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-OQKC5ZU2.js → chunk-NKIELG7Y.js} +22 -1
- package/dist/safe-bash/command-chunks/{chunk-WPYIOKE3.js → chunk-PICVQ6B5.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YOFC45RK.js → chunk-QVOS4YXL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VGG2DL5Q.js → chunk-TRR4MYWF.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-2JRBIDAD.js → chunk-V4K2JDYU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6GWJUQAV.js → chunk-WWIBP2ET.js} +38 -111
- package/dist/safe-bash/command-chunks/chunk-ZDN7MJE6.js +168 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +54 -51
- package/dist/safe-bash/commands/chmod/index.browser.js +14 -0
- package/dist/safe-bash/commands/chmod/index.d.ts +2 -0
- package/dist/safe-bash/commands/chmod/index.js +2 -0
- package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/chmod.js +1 -204
- package/dist/safe-bash/commands/metadata/index.browser.js +1 -5
- package/dist/safe-bash/commands/metadata/internal.d.ts +1 -30
- package/dist/safe-bash/commands/metadata/internal.js +1 -76
- package/dist/safe-bash/commands/metadata/mktemp.d.ts +1 -3
- package/dist/safe-bash/commands/metadata/mktemp.js +1 -202
- package/dist/safe-bash/commands/metadata/stat.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/stat.js +1 -530
- package/dist/safe-bash/commands/mktemp/index.browser.js +13 -0
- package/dist/safe-bash/commands/mktemp/index.d.ts +2 -0
- package/dist/safe-bash/commands/mktemp/index.js +2 -0
- package/dist/safe-bash/commands/node/index.browser.js +2 -2
- package/dist/safe-bash/commands/portable-random.d.ts +1 -1
- package/dist/safe-bash/commands/portable-random.js +1 -12
- package/dist/safe-bash/commands/python/index.browser.js +3 -3
- package/dist/safe-bash/commands/stat/index.browser.js +13 -0
- package/dist/safe-bash/commands/stat/index.d.ts +2 -0
- package/dist/safe-bash/commands/stat/index.js +2 -0
- package/dist/safe-bash/commands/text.js +46 -10
- package/dist/safe-bash/full-core.browser.js +86 -86
- package/dist/safe-bash/jobs.browser.js +2 -2
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +1 -0
- package/dist/safe-bash/optional-host.browser.js +10 -10
- package/dist/safe-bash/plugins/index.browser.js +13 -13
- package/dist/safe-bash/registry-entry.browser.js +16 -16
- package/dist/safe-bash/search.browser.js +14 -14
- package/dist/safe-bash/shell/runtime.d.ts +3 -0
- package/dist/safe-bash/shell/runtime.js +20 -3
- package/dist/safe-bash/shell/types.d.ts +2 -0
- package/dist/safe-bash/shell/worker-limits.js +1 -0
- package/dist/safe-bash/shell-entry.browser.js +12 -12
- package/dist/safe-bash/worker/host.js +1 -1
- package/dist/safe-bash-command-bc/index.js +12 -5
- package/dist/safe-bash-command-bzip2/index.js +4 -3
- package/dist/safe-bash-command-chmod/LICENSE +21 -0
- package/dist/safe-bash-command-chmod/command.d.ts +7 -0
- package/dist/safe-bash-command-chmod/command.js +11 -0
- package/dist/safe-bash-command-chmod/index.d.ts +6 -0
- package/dist/safe-bash-command-chmod/index.js +27 -0
- package/dist/safe-bash-command-exiftool/index.js +5 -5
- package/dist/safe-bash-command-find/find.js +1 -1
- package/dist/safe-bash-command-find/index.js +1 -1
- package/dist/safe-bash-command-fmt/index.js +9 -2
- package/dist/safe-bash-command-gzip/index.js +45 -42
- package/dist/safe-bash-command-imagemagick/index.js +3 -1
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-less/index.js +12 -3
- package/dist/safe-bash-command-mktemp/LICENSE +21 -0
- package/dist/safe-bash-command-mktemp/command.d.ts +3 -0
- package/dist/safe-bash-command-mktemp/command.js +9 -0
- package/dist/safe-bash-command-mktemp/index.d.ts +6 -0
- package/dist/safe-bash-command-mktemp/index.js +25 -0
- package/dist/safe-bash-command-od/index.js +6 -2
- package/dist/safe-bash-command-op/index.js +25 -6
- package/dist/safe-bash-command-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.js +1 -1
- package/dist/safe-bash-command-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- package/dist/safe-bash-command-sips/index.js +13 -5
- package/dist/safe-bash-command-sponge/index.js +10 -3
- package/dist/safe-bash-command-stat/LICENSE +21 -0
- package/dist/safe-bash-command-stat/command.d.ts +7 -0
- package/dist/safe-bash-command-stat/command.js +9 -0
- package/dist/safe-bash-command-stat/index.d.ts +6 -0
- package/dist/safe-bash-command-stat/index.js +25 -0
- package/dist/safe-bash-command-unrtf/index.js +11 -1
- package/dist/safe-bash-command-xxd/index.js +6 -2
- package/dist/safe-bash-command-xz/command.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +3 -2
- package/dist/safe-bash-command-yq/index.js +1 -0
- package/dist/safe-bash-command-yq/native-work.js +1 -0
- package/dist/safe-bash-command-yq/query.js +3 -0
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/options.js +1 -1
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/escaping.js +2 -2
- package/dist/safe-bash-contracts/filesystem-output.js +2 -2
- package/dist/safe-bash-contracts/index.js +2 -2
- package/dist/safe-bash-contracts/io.d.ts +2 -0
- package/dist/safe-bash-contracts/io.js +1 -1
- package/dist/safe-bash-contracts/output.js +2 -2
- package/dist/safe-bash-io-engine/commands/search/requirements.js +1 -1
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +1 -1
- package/dist/safe-bash-mcp/index.browser.js +11 -1
- package/dist/safe-bash-mcp/index.js +35 -16
- package/dist/safe-bash-metadata-engine/LICENSE +21 -0
- package/dist/safe-bash-metadata-engine/index.d.ts +30 -0
- package/dist/safe-bash-metadata-engine/index.js +82 -0
- package/dist/safe-bash-metadata-engine/random.d.ts +1 -0
- package/dist/safe-bash-metadata-engine/random.js +21 -0
- package/dist/safe-bash-regex-engine/index.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.js +1 -1
- package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-search-engine/glob.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +2 -2
- package/dist/safe-bash-search-engine/matcher.js +2 -2
- package/dist/safe-bash-search-engine/options.d.ts +2 -0
- package/dist/safe-bash-search-engine/options.js +1 -1
- package/dist/safe-bash-search-engine/output.js +1 -1
- package/dist/safe-bash-search-engine/shared.js +2 -2
- package/dist/safe-bash-search-engine/walk.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-snapshot-json.js +2 -2
- package/dist/safe-playwright-cloudflare/browser-snapshot-references.js +1 -1
- package/package.json +31 -5
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +0 -962
- package/dist/safe-bash/chunks/{chunk-BJA5XNP6.js → chunk-A7XEHALN.js} +3 -3
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_buffer
|
|
3
|
+
} from "./chunk-HX3SHTCE.js";
|
|
4
|
+
|
|
5
|
+
// packages/safe-bash-command-chmod/src/command.ts
|
|
6
|
+
init_buffer();
|
|
7
|
+
import { modeChange } from "../../safe-bash-io-engine/commands/mode-change.js";
|
|
8
|
+
import { modeChange as modeChange2 } from "../../safe-bash-io-engine/commands/mode-change.js";
|
|
9
|
+
import { bindConditionalMutation } from "@poe-platform/safe-fs/core";
|
|
10
|
+
import { creationUmask } from "../../safe-bash-contracts/runtime-control.js";
|
|
11
|
+
import { FsError } from "../../safe-bash-contracts/index.js";
|
|
12
|
+
import { codeOf, diagnostic, options, pathOf, requireOperands, syncCommandEvaluators, UsageError, value } from "../../safe-bash-io-engine/internal.js";
|
|
13
|
+
import { gnuInformationSync } from "../../safe-bash-io-engine/gnu-information.js";
|
|
14
|
+
import { MetadataBudget, metadataCommand, permissionString, settings } from "../../safe-bash-metadata-engine/index.js";
|
|
15
|
+
function createChmodCommand(configuration = {}) {
|
|
16
|
+
const configured = settings(configuration);
|
|
17
|
+
const configuredUmask = configuration.umask === void 0 ? void 0 : configured.umask;
|
|
18
|
+
return metadataCommand("chmod", async (context) => {
|
|
19
|
+
const budget = new MetadataBudget(context, configured.limits);
|
|
20
|
+
const modeOptions = [];
|
|
21
|
+
let ended = false, referenceValue = false;
|
|
22
|
+
const args = context.args.flatMap((argument) => {
|
|
23
|
+
if (referenceValue) {
|
|
24
|
+
referenceValue = false;
|
|
25
|
+
return [argument];
|
|
26
|
+
}
|
|
27
|
+
if (argument === "--") ended = true;
|
|
28
|
+
if (ended) return [argument];
|
|
29
|
+
if (argument === "--reference") referenceValue = true;
|
|
30
|
+
if (argument.startsWith("-") && argument.length > 1 && "rwxXstugo01234567".includes(argument[1])) {
|
|
31
|
+
modeOptions.push(argument);
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return [argument];
|
|
35
|
+
});
|
|
36
|
+
const parsed = options(args, "Rvcf", { recursive: "R", verbose: "v", changes: "c", silent: "f", quiet: "f", reference: "reference:" });
|
|
37
|
+
const reference = value(parsed, "reference");
|
|
38
|
+
if (reference !== void 0 && modeOptions.length) throw new UsageError("cannot combine mode and --reference options");
|
|
39
|
+
requireOperands(parsed.operands, reference === void 0 && !modeOptions.length ? 2 : 1);
|
|
40
|
+
const mode = modeOptions.length ? modeOptions.join(",") : reference === void 0 ? parsed.operands.shift() : void 0;
|
|
41
|
+
const mask = configuredUmask ?? Reflect.get(context.fs, creationUmask);
|
|
42
|
+
const activeUmask = typeof mask === "number" ? mask : configured.umask;
|
|
43
|
+
const change = mode === void 0 ? void 0 : modeChange(mode, activeUmask);
|
|
44
|
+
const paths = parsed.operands;
|
|
45
|
+
if (context.fs.capabilities.readOnly) throw new FsError("EROFS", { syscall: "chmod" });
|
|
46
|
+
if (!context.fs.chmod || context.fs.capabilities.permissions === false) throw new FsError("ENOTSUP", { syscall: "chmod" });
|
|
47
|
+
const referenceMode = reference === void 0 ? void 0 : (await context.fs.stat(pathOf(context, reference), { signal: context.signal })).mode & 4095;
|
|
48
|
+
let exitCode = 0;
|
|
49
|
+
const visit = async (path, display, depth, top) => {
|
|
50
|
+
await budget.step(depth);
|
|
51
|
+
const link = await context.fs.lstat(path, { signal: context.signal });
|
|
52
|
+
if (link.type === "symlink" && !top) return;
|
|
53
|
+
const target = link.type === "symlink" ? await context.fs.realpath(path, { signal: context.signal }) : path;
|
|
54
|
+
const stat = link.type === "symlink" ? await context.fs.stat(target, { signal: context.signal }) : link;
|
|
55
|
+
const mode2 = referenceMode ?? change(stat);
|
|
56
|
+
if (parsed.flags.has("R") && stat.type === "directory" && await context.fs.realpath(target, { signal: context.signal }) === "/") throw new FsError("EBUSY", { syscall: "chmod", path, message: "refusing recursive mode changes at virtual root" });
|
|
57
|
+
const canonicalTarget = await context.fs.realpath(target, { signal: context.signal });
|
|
58
|
+
const apply = async () => {
|
|
59
|
+
context.signal.throwIfAborted();
|
|
60
|
+
const currentCanonical = await context.fs.realpath(target, { signal: context.signal });
|
|
61
|
+
if (currentCanonical !== canonicalTarget) throw new FsError("EIO", { syscall: "chmod", path, message: "path changed during permission update" });
|
|
62
|
+
const fresh = await context.fs.lstat(canonicalTarget, { signal: context.signal });
|
|
63
|
+
if (fresh.type === "symlink" || fresh.type !== stat.type || stat.ino !== void 0 && fresh.ino !== stat.ino || stat.dev !== void 0 && fresh.dev !== stat.dev) throw new FsError("EIO", { syscall: "chmod", path, message: "path changed during permission update" });
|
|
64
|
+
const capabilities = await context.fs.capabilitiesFor?.(canonicalTarget, { signal: context.signal, conditionalChmod: true }) ?? context.fs.capabilities;
|
|
65
|
+
context.signal.throwIfAborted();
|
|
66
|
+
if (capabilities.conditionalChmod !== true) throw new FsError("ENOTSUP", { syscall: "chmod", path, message: "conditional permission updates are not supported" });
|
|
67
|
+
const parentPath = canonicalTarget.slice(0, canonicalTarget.lastIndexOf("/")) || "/";
|
|
68
|
+
const ancestorPaths = ["/"];
|
|
69
|
+
if (parentPath !== "/") {
|
|
70
|
+
let prefix = "";
|
|
71
|
+
for (const part of parentPath.split("/").filter(Boolean)) {
|
|
72
|
+
prefix += `/${part}`;
|
|
73
|
+
ancestorPaths.push(prefix);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const ancestors = await Promise.all(ancestorPaths.map(async (entryPath) => ({
|
|
77
|
+
path: entryPath,
|
|
78
|
+
stat: await context.fs.lstat(entryPath, { signal: context.signal })
|
|
79
|
+
})));
|
|
80
|
+
const parentStat = ancestors.at(-1).stat;
|
|
81
|
+
const mutation = { signal: context.signal, parent: parentStat, expected: fresh, ancestors };
|
|
82
|
+
await bindConditionalMutation(
|
|
83
|
+
fresh.identityScope,
|
|
84
|
+
{ path: canonicalTarget, parent: parentStat, expected: fresh, ancestors },
|
|
85
|
+
() => context.fs.chmod(canonicalTarget, mode2, mutation)
|
|
86
|
+
);
|
|
87
|
+
if (parsed.flags.has("v") || parsed.flags.has("c") && mode2 !== (stat.mode & 4095)) {
|
|
88
|
+
await budget.output(`mode of '${display}' ${mode2 === (stat.mode & 4095) ? "retained as" : "changed from " + (stat.mode & 4095).toString(8).padStart(4, "0") + " (" + permissionString(stat.mode, stat.type).slice(1) + ") to"} ${mode2.toString(8).padStart(4, "0")} (${permissionString(mode2, stat.type).slice(1)})
|
|
89
|
+
`);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const deferred = stat.type === "directory" && parsed.flags.has("R") && (stat.mode & 511 & ~mode2) !== 0;
|
|
93
|
+
if (!deferred) await apply();
|
|
94
|
+
if (stat.type === "directory" && parsed.flags.has("R")) {
|
|
95
|
+
const entries = await context.fs.readdir(target, {
|
|
96
|
+
signal: context.signal,
|
|
97
|
+
...Number.isFinite(budget.remainingEntries) ? { maxEntries: budget.remainingEntries } : {}
|
|
98
|
+
});
|
|
99
|
+
if (entries.length > budget.remainingEntries) throw new FsError("EFBIG", { message: "metadata traversal limit exceeded" });
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
if (!entry.name || entry.name === "." || entry.name === ".." || entry.name.includes("/") || entry.name.includes("\0")) throw new FsError("EIO", { message: "invalid directory entry" });
|
|
102
|
+
try {
|
|
103
|
+
await visit(`${target.replace(/\/$/u, "")}/${entry.name}`, `${display.replace(/\/$/u, "")}/${entry.name}`, depth + 1, false);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
context.signal.throwIfAborted();
|
|
106
|
+
if (codeOf(error) === "EFBIG") throw error;
|
|
107
|
+
exitCode = 1;
|
|
108
|
+
if (!parsed.flags.has("f")) await diagnostic(context, error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (deferred) await apply();
|
|
113
|
+
};
|
|
114
|
+
for (const operand of paths) {
|
|
115
|
+
try {
|
|
116
|
+
await visit(pathOf(context, operand), operand, 0, true);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
context.signal.throwIfAborted();
|
|
119
|
+
if (codeOf(error) === "EFBIG") throw error;
|
|
120
|
+
exitCode = 1;
|
|
121
|
+
if (!parsed.flags.has("f")) await diagnostic(context, error);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { exitCode };
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function evalSyncChmod(opArgs, umask, chmodNodeSync) {
|
|
128
|
+
const gnuInfo = gnuInformationSync("chmod", opArgs);
|
|
129
|
+
if (gnuInfo !== void 0) return gnuInfo;
|
|
130
|
+
if (!chmodNodeSync) return void 0;
|
|
131
|
+
try {
|
|
132
|
+
const modeOptions = [];
|
|
133
|
+
let ended = false;
|
|
134
|
+
let referenceValue = false;
|
|
135
|
+
const args = [];
|
|
136
|
+
for (const argument of opArgs) {
|
|
137
|
+
if (referenceValue) {
|
|
138
|
+
referenceValue = false;
|
|
139
|
+
args.push(argument);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (argument === "--") {
|
|
143
|
+
ended = true;
|
|
144
|
+
args.push(argument);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!ended && argument === "--reference") {
|
|
148
|
+
referenceValue = true;
|
|
149
|
+
args.push(argument);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (!ended && argument.startsWith("-") && argument.length > 1 && "rwxXstugo01234567".includes(argument[1])) {
|
|
153
|
+
modeOptions.push(argument);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
args.push(argument);
|
|
157
|
+
}
|
|
158
|
+
const parsed = options(args, "vcf", { verbose: "v", changes: "c", silent: "f", quiet: "f", reference: "reference:" });
|
|
159
|
+
const reference = value(parsed, "reference");
|
|
160
|
+
if (reference !== void 0 && modeOptions.length) return void 0;
|
|
161
|
+
const minOps = reference !== void 0 || modeOptions.length ? 1 : 2;
|
|
162
|
+
if (parsed.operands.length < minOps) return void 0;
|
|
163
|
+
let referenceMode;
|
|
164
|
+
if (reference !== void 0) {
|
|
165
|
+
if (!chmodNodeSync(reference, (stat) => {
|
|
166
|
+
referenceMode = stat.mode & 4095;
|
|
167
|
+
return stat.mode;
|
|
168
|
+
}) || referenceMode === void 0) {
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const mode = modeOptions.length ? modeOptions.join(",") : reference === void 0 ? parsed.operands.shift() : void 0;
|
|
173
|
+
const change = mode === void 0 ? void 0 : modeChange(mode, umask);
|
|
174
|
+
let out = "";
|
|
175
|
+
for (const op of parsed.operands) {
|
|
176
|
+
let line = "";
|
|
177
|
+
const ok = chmodNodeSync(op, (stat) => {
|
|
178
|
+
const oldMode = stat.mode & 4095;
|
|
179
|
+
const nextMode = (referenceMode ?? change(stat)) & 4095;
|
|
180
|
+
if (parsed.flags.has("v") || parsed.flags.has("c") && nextMode !== oldMode) {
|
|
181
|
+
line = `mode of '${op}' ${nextMode === oldMode ? "retained as" : "changed from " + oldMode.toString(8).padStart(4, "0") + " (" + permissionString(oldMode, stat.type).slice(1) + ") to"} ${nextMode.toString(8).padStart(4, "0")} (${permissionString(nextMode, stat.type).slice(1)})
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
return nextMode;
|
|
185
|
+
});
|
|
186
|
+
if (!ok) return void 0;
|
|
187
|
+
out += line;
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
} catch {
|
|
191
|
+
return void 0;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
syncCommandEvaluators.evalSyncChmod = evalSyncChmod;
|
|
195
|
+
|
|
196
|
+
export {
|
|
197
|
+
createChmodCommand,
|
|
198
|
+
evalSyncChmod,
|
|
199
|
+
modeChange2 as modeChange
|
|
200
|
+
};
|
|
@@ -125,7 +125,7 @@ function syntheticStatFor(type) {
|
|
|
125
125
|
function createFindDefinitions(execute, maxDirectoryEntries) {
|
|
126
126
|
const readDirectory = createDirectoryReader(maxDirectoryEntries);
|
|
127
127
|
const defs = [define("find", (context) => {
|
|
128
|
-
if (!context.argumentValues && context.args.length === 3 && (context.args[1] === "-name" || context.args[1] === "-iname") && !sharedFindPrintBufInUse && !context.signal.aborted) {
|
|
128
|
+
if (context._hasInfiniteFsOpsLimit === true && !context.argumentValues && context.args.length === 3 && (context.args[1] === "-name" || context.args[1] === "-iname") && !sharedFindPrintBufInUse && !context.signal.aborted) {
|
|
129
129
|
const rootDisplay = context.args[0];
|
|
130
130
|
if (rootDisplay && !rootDisplay.startsWith("-") && rootDisplay !== "!" && rootDisplay !== "(") {
|
|
131
131
|
const fastBacking = context._fastMemoryBackingFs;
|
|
@@ -658,7 +658,7 @@ ${explicitAction ? tree : `AND(${tree}, implicit -print)`}
|
|
|
658
658
|
})();
|
|
659
659
|
};
|
|
660
660
|
const canSkipChildStat = !needsStat && !explicitAction && follow !== "-L";
|
|
661
|
-
const backing = getRuntimeBackingFileSystem(context.fs);
|
|
661
|
+
const backing = context._hasInfiniteFsOpsLimit === true ? getRuntimeBackingFileSystem(context.fs) : void 0;
|
|
662
662
|
const maxEntriesLimit = maxDirectoryEntries ?? Infinity;
|
|
663
663
|
let uniformDirAdmitted = false;
|
|
664
664
|
const scratchChildEntry = { path: "", display: "", name: "", stat: SYNTHETIC_FILE_STAT, symlink: false, depth: 0, root: "", relative: "", prune: false };
|