-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Interactive-Consolethe console experiencethe console experience
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
I am experiencing a problem with the UnixMode parameter when dealing with suid/sgid bits.
It does not appear to properly display the S flag.
The UnixFileMode parameter, on the other hand, does properly identify SetGroup as being set.
Starting everything with a directory with mode u=rwx,g=rw,o=rx and everything works as expected.
But if we add the sgid flag UnixFileMode works as expected, but UnixMode does not output the S (see the actual below)
If we finally add the execute bit to the directory, then both UnixFileMode and UnixMode operate as expected and the s is output
PS /tmp> chmod g+x /tmp/bugexample/
PS /tmp> ls -alhd /tmp/bugexample
drwxrwsr-x 2 root root 4.0K Sep 14 16:50 /tmp/bugexample
PS /tmp> (Get-Item /tmp/bugexample/).UnixFileMode
OtherExecute, OtherRead, GroupExecute, GroupWrite, GroupRead, UserExecute, UserWrite, UserRead, SetGroup
PS /tmp> (Get-Item /tmp/bugexample/).UnixMode
drwxrwsr-xI would prefer either
- That UnixMode output the uppercase
Sif suid/sgid is set but the file is not executable - It is made clear that special bits are not displayed in UnixMode and that UnixFileMode should be used instead.
Expected behavior
PS /tmp> mkdir /tmp/testsgid
PS /tmp> chmod u=rwx,g=rw /tmp/testsgid
PS /tmp> chmod g+s /tmp/testsgid
PS /tmp> ls -alhd /tmp/testsgid/
drwxrwSr-x 2 root root 4.0K Sep 14 17:10 /tmp/testsgid/
PS /tmp> (Get-Item /tmp/testsgid/).UnixFileMode
OtherExecute, OtherRead, GroupWrite, GroupRead, UserExecute, UserWrite, UserRead, SetGroup
PS /tmp> (Get-Item /tmp/testsgid/).UnixMode
drwxrwSr-xActual behavior
PS /tmp> mkdir /tmp/testsgid
PS /tmp> chmod u=rwx,g=rw /tmp/testsgid
PS /tmp> chmod g+s /tmp/testsgid
PS /tmp> ls -alhd /tmp/testsgid/
drwxrwSr-x 2 root root 4.0K Sep 14 17:10 /tmp/testsgid/
PS /tmp> (Get-Item /tmp/testsgid/).UnixFileMode
OtherExecute, OtherRead, GroupWrite, GroupRead, UserExecute, UserWrite, UserRead, SetGroup
PS /tmp> (Get-Item /tmp/testsgid/).UnixMode
drwxrw-r-xError details
No response
Environment data
PS /tmp> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Linux 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
237dmitry
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Interactive-Consolethe console experiencethe console experience