Skip to content

Need better error message when it fails to create a Mutex due to no-write permission to the '/tmp' folder on macOS or Linux #36823

Closed

Description

@daxian-dbw

We consistently get issue reports in PSReadLine about an IOException when creating a Mutex object on macOS:

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_1525368525'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

I worked with a user on that issue and it turned out it was because the /tmp folder (mapped to /private/tmp) on the user's mac shows 755 for the permissions, namely no write permission for a non-root user. The user thought the permission change could be caused by Homebrew, and Mutex creation works fine after changing the permission to 777, see PowerShell/PSReadLine#1464 (comment)

The error message is not helpful to get to the root of the problem. Given it's a permission issue, it could be great if the error message could indicate the permission issue.

Activity

  1. self-assigned this
    on Jul 6, 2020
  2. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 6, 2020
  3. added this to the 5.0.0 milestone on Jul 6, 2020
  4. modified the milestones: 5.0.0, 6.0.0 on Jul 21, 2020
  5. modified the milestones: 6.0.0, 7.0.0 on Jul 21, 2021
  6. modified the milestones: 7.0.0, 8.0.0 on Jul 27, 2022
  7. modified the milestones: 8.0.0, 9.0.0 on Aug 10, 2023
  8. kouvel commented on Aug 10, 2023

    @kouvel
    Contributor

    Consolidating into #89090

  9. ghost locked as resolved and limited conversation to collaborators on Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions