Skip to content

Fix mkfifo symbolic mode handling for POSIX compliance#556

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-mkfifo-mode-behavior
Draft

Fix mkfifo symbolic mode handling for POSIX compliance#556
Copilot wants to merge 4 commits intomainfrom
copilot/fix-mkfifo-mode-behavior

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

mkfifo was incorrectly handling symbolic modes: -m +x produced 0755 instead of 0777, and -m -w failed to parse. Per POSIX, symbolic modes in mkfifo must start from a=rw (0666) and explicit -m should bypass umask.

Changes

  • tree/mkfifo.rs: Added allow_hyphen_values = true to clap parser; temporarily set umask to 0 when creating FIFO with explicit -m flag
  • plib/src/modestr.rs: Fixed Remove operation umask logic - changed from user &= !(rwx << 6) & !umask to user &= !(rwx << 6) | (umask & S_IRWXU) to correctly protect masked bits from removal
  • tree/tests/mkfifo/mod.rs: Added 8 integration tests covering symbolic/absolute modes and error cases

Behavior

# Before: 0755 (wrong), After: 0777 (correct)
$ umask 0022
$ mkfifo -m +x fifo
$ ls -l fifo
prwxrwxrwx  # now matches GNU mkfifo

# Before: parse error, After: 0466 (correct)
$ mkfifo -m -w fifo
$ ls -l fifo
pr--rw-rw-  # umask 0022 protects group/other write from removal

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pubs.opengroup.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>mkfifo wrong behavior is possible</issue_title>
<issue_description>Hi.
from posix spec

In the symbolic_mode strings, the op characters '+' and '-' shall be interpreted relative to an assumed initial mode of a=rw.

mkfifo -m +x file
prwxr-xr-x

but shall be
prwxrwxrwx

mkfifo -m -w file
error: unexpected argument '-w' found</issue_description>

<agent_instructions>Review POSIX spec for mkfifo then proceed</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 8, 2026 07:40
- Fix clap to allow mode values starting with - (e.g., `-m -w`)
- Fix modestr::mutate to correctly handle Remove operations with umask
- Bypass umask when creating FIFO with explicit -m mode per POSIX
- When no who is specified in symbolic mode remove operations, umask protects bits from being removed

Co-authored-by: jgarzik <494411+jgarzik@users.noreply.github.com>
- Test basic FIFO creation
- Test error cases (already exists, invalid mode)
- Test absolute mode setting
- Test symbolic modes (+x, -w, a-w)
- Test multiple FIFO creation
- All tests verify POSIX-compliant behavior

Co-authored-by: jgarzik <494411+jgarzik@users.noreply.github.com>
- Replace dummy umask value with Option<mode_t>
- Improves code clarity and safety

Co-authored-by: jgarzik <494411+jgarzik@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mkfifo mode behavior for permissions Fix mkfifo symbolic mode handling for POSIX compliance Feb 8, 2026
Copilot AI requested a review from jgarzik February 8, 2026 07:48
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.

mkfifo wrong behavior is possible

2 participants