Skip to content

ares-package: make every directory 0777, like ares-cli does - #16

Merged
mariotaku merged 1 commit into
mainfrom
fix/package-dir-mode
Aug 23, 2026
Merged

ares-package: make every directory 0777, like ares-cli does#16
mariotaku merged 1 commit into
mainfrom
fix/package-dir-mode

Conversation

@mariotaku

@mariotaku mariotaku commented Aug 23, 2026

Copy link
Copy Markdown
Member

Directory entries were hardcoded to 0775. ares-cli emits 0777 for every directory, so match it.

What ares-cli actually does

It forces its umask to 0 (lib/package.js, setUmask.bind(this, 0), applied at all three packaging entry points) and stages the tree with mkdirp's 0777, so the source tree's own modes never reach the ipk.

Verified end-to-end against @webos-tools/cli 3.2.5 on the same source tree — note locked/, which is 0700 on disk:

drwxrwxrwx  usr/palm/applications/com.example.lg/
drwxrwxrwx  usr/palm/applications/com.example.lg/assets/
drwxrwxrwx  usr/palm/applications/com.example.lg/locked/     <- 0700 in source
-rw-r--r--  usr/palm/applications/com.example.lg/index.html

The masking in its fixupDirs"Make sure readable directories have execute permission", plus a service-directory case that would take 0755 to 0777 — is dead code. The staging dirs are already 0777 by the time the tar filter runs, so neither branch changes a bit.

Also in here

  • Fixes the type bit, which said S_IFREG for a directory entry. Harmless, since libopkg masks & 0o7777, but wrong.
  • uid/gid stay 0/5000. ares-cli writes whoever ran the build instead, but the install discards both, so there is nothing to match here.
  • File modes are untouched.

Result

Output now matches ares-cli on every member except packageinfo.json, where it emits 0666 and this emits 0644fs.writeFile's default 0666 falling through the forced umask, rather than a decision.

Two tests added: every directory is 0o040_777 + EntryType::Directory, and files are neither group- nor world-writable.

Not addressed

ares-cli does entry.mode |= 0o004 on every file, guaranteeing world-readable. We take the source mode as-is, so a 0600 file in the source ships as 0600. That's a parity gap, but it's a file-mode change and out of scope here.

@mariotaku
mariotaku force-pushed the fix/package-dir-mode branch from 6193d66 to 0ff5a11 Compare August 23, 2026 14:03
Directory entries were hardcoded to 0775. ares-cli emits 0777 for every
directory, so match it.

It forces its umask to 0 (lib/package.js, setUmask.bind(this, 0)) and
stages the tree with mkdirp's 0777, so the source tree's own modes never
reach the ipk. Verified against @webos-tools/cli 3.2.5: a directory that
is 0700 in the source tree comes out 0777.

The masking in its fixupDirs - "readable directories have execute
permission", plus a service-directory case that would take 0755 to 0777 -
is dead code. The staging dirs are already 0777 by the time the tar filter
runs, so neither branch changes a bit.

Also fixes the type bit, which said S_IFREG for a directory entry.
Harmless, since libopkg masks & 0o7777, but wrong.

uid/gid are left alone. ares-cli writes whoever ran the build instead, but
the install discards both, so there is nothing to match here.

Output now matches ares-cli on every member except packageinfo.json, where
it emits 0666 and this emits 0644 - fs.writeFile's default 0666 falling
through the forced umask, rather than a decision.

File modes are untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gde2tcn5SbUHKhesuTNB7a
@mariotaku
mariotaku force-pushed the fix/package-dir-mode branch from 0ff5a11 to 80bd445 Compare August 23, 2026 14:05
@mariotaku
mariotaku merged commit 1753778 into main Aug 23, 2026
4 checks passed
@mariotaku
mariotaku deleted the fix/package-dir-mode branch August 23, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant