Skip to content

set -S should mark read-only variables #8179

Closed

Description

@lilyball

fish 3.3.1

Most special variables defined by fish are read-only. set -S does not indicate this in any way. For example:

 ❯ set -S PWD
$PWD: set in global scope, exported, with 1 elements
$PWD[1]: |/Users/lily|

This should instead look something like

 ❯ set -S PWD
$PWD: set in global scope, exported, read-only, with 1 elements
$PWD[1]: |/Users/lily|

Activity

  1. added this to the fish-future milestone on Jul 28, 2021
  2. zx8 commented on Jul 28, 2021

    @zx8

    Apparently $PWD is not read-only 😄

    $ set -S PWD
    $PWD: set in global scope, exported, with 1 elements
    $PWD[1]: |/usr/local/bin|
    
    $ set -S status
    $status: set in global scope, unexported, with 1 elements
    Variable is read-only
    $status[1]: |0|
    
  3. lilyball commented on Jul 28, 2021

    @lilyball
    ContributorAuthor

    Was $PWD made writable since 3.3.1? Because it's read-only there.

    ❯ set PWD foo
    set: Tried to change the read-only variable “PWD”
    
  4. faho commented on Jul 28, 2021

    @faho
    Member

    It is read-only, setting it fails correctly, the display is broken.

    I think there might be two different variables floating around?

    In one place var->readonly() returns true, in another false?

  5. added a commit that references this issue on Jul 28, 2021
  6. faho commented on Jul 28, 2021

    @faho
    Member

    Ya know what? All the other vars work, so there's something funky going on with $PWD.

    I just hard-coded it for now in set --show.

  7. lilyball commented on Jul 30, 2021

    @lilyball
    ContributorAuthor

    I just put a comment on the commit explaining the issue b3cdf4a#r54169505

  8. modified the milestones: fish-future, fish 3.4.0 on Aug 1, 2021
  9. added a commit that references this issue on Dec 12, 2021
  10. locked as resolved and limited conversation to collaborators on Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions