Skip to content

Make X compatible with Linux/POSIX#2

Merged
tonistiigi merged 1 commit intomainfrom
tonistiigi/linux-X-support
Mar 18, 2025
Merged

Make X compatible with Linux/POSIX#2
tonistiigi merged 1 commit intomainfrom
tonistiigi/linux-X-support

Conversation

@tonistiigi
Copy link
Owner

BSD supported only + operator for X but Linux and
latest POSIX supports any operator.

Fix for moby/buildkit#5835

{0777, 0666, 0000, "-x"},
{0777, 0777, 0000, "-X"},
{os.ModeDir | 0777, os.ModeDir | 0777, 0000, "-X"},
{0777, 0666, 0000, "-X"},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear if these -X cases were intentional but I've tested new expected values against Linux.

BSD supported only + operator for X but Linux and
latest POSIX supports any operator.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi
Copy link
Owner Author

PTAL @crazy-max

@tonistiigi tonistiigi requested a review from Copilot March 18, 2025 00:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the behavior of the X permission operator to be compatible with Linux/POSIX standards by modifying test cases and updating the parsing logic.

  • Updated test cases in mode_test.go to reflect the new expected outcomes for the X operator.
  • Modified the condition in mode.go's ParseWithUmask function to handle operators other than '-' when applying X permissions.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
mode_test.go Adjusted test cases to verify Linux/POSIX-compatible behavior for the X operator
mode.go Updated the conditional logic for handling the X operator to support Linux/POSIX semantics
Comments suppressed due to low confidence (1)

mode.go:265

  • Changing the condition from 'if op == "+"' to 'if op != "-"' now applies the X permission setting for both '+' and '=' operators; please verify that this behavior aligns with the desired Linux/POSIX semantics.
if op != '-' {

{0777, 0666, 0000, "-x"},
{0777, 0777, 0000, "-X"},
{os.ModeDir | 0777, os.ModeDir | 0777, 0000, "-X"},
{0777, 0666, 0000, "-X"},
Copy link

Copilot AI Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected permission value for the "-X" test case was changed from 0777 to 0666; please confirm that this update accurately reflects the intended Linux/POSIX behavior.

Suggested change
{0777, 0666, 0000, "-X"},
{0666, 0666, 0000, "-X"},

Copilot uses AI. Check for mistakes.
@tonistiigi tonistiigi merged commit 73d941a into main Mar 18, 2025
11 checks passed
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.

3 participants