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

universal exported environment variable not exported anymore on subsequent assignations #6895

Closed
shouze opened this issue Apr 13, 2020 · 7 comments

Comments

@shouze
Copy link

shouze commented Apr 13, 2020

Environment
fish --version fish, version 3.1.0
uname -a Linux sebastien-XPS-13-7390 4.15.0-1076-oem #86-Ubuntu SMP
echo $TERM xterm-256color

How to reproduce?

If I run a parent fish process:

fish --debug="env-export" --debug-output=/tmp/parent.output -D 128 -l

When I execute the following commands, exported values are not recalculated on subsequent assignments:

echo "1. First assignment"
set -e my_var
set -S my_var
env | grep my_var && echo "env $my_var"
fish --debug="env-export" --debug-output=/tmp/child.output -D 128 -c 'set -Ux my_var foo'
# produces env-export: create_export_array() recalc: 1 in parent, 2 in child
env | string match my_var=\* && echo "env $my_var"
echo
echo "2. Second assignment, parent fish process is no more consistent about variable value"
fish --debug="env-export" --debug-output=/tmp/child.output -D 128 -c 'set -Ux my_var bar'
# produces env-export: create_export_array() recalc: 0 in parent, 2 in child
env | string match my_var=\* && echo "env $my_var"
echo
echo "3. Unless it reloads"
source ~/.config/fish/config.fish
# produces env-export: create_export_array() recalc: 2 in parent, 0 in child (no child exec)
env | string match my_var=\* && echo "env $my_var"

1. First assignment
$my_var: not set in local scope
$my_var: not set in global scope
$my_var: not set in universal scope

my_var=foo
env foo
$my_var: not set in local scope
$my_var: not set in global scope
$my_var: set in universal scope, exported, with 1 elements
$my_var[1]: length=3 value=|foo|

my_var=foo
env foo

2. Second assignment, parent fish process is no more consistent about variable value
my_var=bar
env bar
$my_var: not set in local scope
$my_var: not set in global scope
$my_var: set in universal scope, exported, with 1 elements
$my_var[1]: length=3 value=|bar|

my_var=foo
env bar

3. Unless it reloads
my_var=bar
env bar
@shouze
Copy link
Author

shouze commented Apr 13, 2020

This is maybe related to #5258 and #6218?

@krobelus krobelus added the bug Something that's not working as intended label Apr 13, 2020
@krobelus
Copy link
Member

Yeah, the exported variables need to be updated here

@krobelus krobelus added the regression Something that used to work, but was broken, especially between releases label Apr 13, 2020
@shouze
Copy link
Author

shouze commented Apr 13, 2020

And maybe related to #6653? ping @ridiculousfish

Looks like there's a regression between 3.0.2 and 3.1.1 as I don't reproduce it on 3.0.2:
image

@krobelus
Copy link
Member

Duplicate of #6612

@krobelus krobelus marked this as a duplicate of #6612 Apr 13, 2020
@krobelus krobelus added duplicate and removed bug Something that's not working as intended regression Something that used to work, but was broken, especially between releases labels Apr 13, 2020
@shouze
Copy link
Author

shouze commented Apr 13, 2020

@krobelus Ok, seen your fix, but I have bad news, I can still reproduce it. working on another issue to explain how. I'm now using HEAD's repo fish to ensure this gets fixed 😉

@shouze
Copy link
Author

shouze commented Apr 14, 2020

@krobelus ok no in fact all is good since your latest patch! 🎉
I had issues related to a Makefile in the project I've found the env var bug. I've also fixed on my side now.

@krobelus
Copy link
Member

Sounds good, thanks for filing, please report if you find anything else that's fishy.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants