8000 `vared tmp` doesn't set `tmp` · Issue #8836 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

vared tmp doesn't set tmp #8836

@0ion9

Description

@0ion9

Fish $version: 3.4.0-53-g3e5284aaf
OS: Arch linux x86_64
Terminal: Sakura 3.8.4
Effected by user config: No

Summary: vared specifically fails to set a variable named tmp. Any other names I have tested work correctly (ie. do set the variable.). 'Emulating' vared via set tmp (read) works correctly.

How to reproduce:

vared tmp; vared tmp2; set -S tmp tmp2
(input some values)
-> tmp is unset, tmp2 is set correctly (global var, unexported).

This is probably tied to the internal use of 'tmp' as a variable name. Changing this name to something more obscure like __vared_user_input seems to fix the problem.

Another facet of the issue is that set $argv is inadequate when the value of argv matches the name of the temporary variable (and the above 'fix' is obviously only a workaround). What vared really wants to do is set the nearest-scoped variable named by $argv that isn't of the same scope as the temporary variable. Not sure if there is actually a way to do that. It might be easier for fish to provide a mktempvar builtin, which could provide a pretty good guarantee that the generated variable name would not collide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0