Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AllUsers scope doesn't work if umask is set. #1695

Open
3 tasks done
natedogith1 opened this issue Sep 6, 2024 · 3 comments
Open
3 tasks done

AllUsers scope doesn't work if umask is set. #1695

natedogith1 opened this issue Sep 6, 2024 · 3 comments

Comments

@natedogith1
Copy link

natedogith1 commented Sep 6, 2024

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Running on a linux machine

  1. running from a root bash shell
  2. umask 0027
  3. pwsh
  4. Install-PSResource Az -Scope AllUsers
  5. Get-InstalledPSResource Az -Scope AllUsers
  6. Notice that module is found
  7. In non-root pwsh: Get-InstalledPSResource Az -Scope AllUsers
  8. Notice that the module is not found
  9. In root bash shell: chmod -R a+rX /usr/local/share/powershell/
  10. In non-root pwsh: Get-InstalledPSResource Az -Scope AllUsers
  11. Notice that the module is now found

Expected behavior

Module is available in root and non-root pwsh

Actual behavior

Module only available in root pwsh

Error details

PS /home/nfaulkne> Get-InstalledPSResource Az -Scope AllUsers
Get-InstalledPSResource: No match was found for package 'Az'.
PS /home/nfaulkne> Get-Error

Exception             :
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    Message : No match was found for package 'Az'.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.GetInstalledPSResourceCommand
CategoryInfo          : ObjectNotFound: (Microsoft.PowerShel…edPSResourceCommand:GetInstalledPSResourceCommand) [Get-In
stalledPSResource], ResourceNotFoundException
FullyQualifiedErrorId : InstalledPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.GetInstalledPSResourceComma
nd
InvocationInfo        :
    MyCommand        : Get-InstalledPSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 1
    Line             : Get-InstalledPSResource Az -Scope AllUsers
    Statement        : Get-InstalledPSResource Az -Scope AllUsers
    PositionMessage  : At line:1 char:1
                       + Get-InstalledPSResource Az -Scope AllUsers
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Get-InstalledPSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
      0
      1

Environment data

PS /root> Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.4.1               Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PS…

Key   : PSVersion
Value : 7.4.5
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.4.5
Name  : GitCommitId


Key   : OS
Value : Ubuntu 22.04.3 LTS
Name  : OS


Key   : Platform
Value : Unix
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

@natedogith1
Copy link
Author

There was an existing issue #364 that looks to be the same problem, but it's been closed for two years.

@SydneyhSmith SydneyhSmith added Issue-Bug Something isn't working Area-Install and removed Needs-Triage labels Sep 10, 2024
@SydneyhSmith
Copy link
Collaborator

@natedogith1 I noticed you are mixing PowerShellGet and PSResourceGet... does it repro if you use all PSResourceGet i.e. Install-PSResource?

@natedogith1
Copy link
Author

I tested with Install-PSResource once I realized Install-Module was using the old PowerShellGet instead of the newer Microsoft.PowerShell.PSResourceGet, but it seems I updated the Get-InstalledModule in the reproduction steps but forgot to update the Install-Module. I've just re-tested and updated the reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants