protonscr

steamwebhelper.sh: line 48: fg: unbound variable

steamclosed Distro Family: ArchWeb Component
ValveSoftware/steam-for-linux#8054 · opened 2021-09-10 by rixx · updated 2021-09-14 · 12 comments · github
Rrixx 2021-09-10 github

Your system information

  • Steam client version (build number or date): Arch package steam-1.0.0.72-1, build date Sep 10 2021 01:00:50
  • Distribution (e.g. Ubuntu): Arch
  • Opted into Steam client beta?: [Yes/No] Yes (issue occurred in both cases)
  • Have you checked for system updates?: [Yes/No] Yes

Please describe your issue in as much detail as possible:

On running Steam after the latest update, I can only see empty screens on all tabs. Interacting with settings still works. The issue occurred with and without the beta, and with freetype2 2.10.4 and 2.11.0 (I checked after reading #7935).

steam -no-browser steam://open/minigameslist works as expected.

Logs: https://gist.github.com/rixx/5708693e56135b40c869257f1a67c39d

Kkisak-valve maintainer 2021-09-10 github

Hello @rixx, steamwebhelper.sh: line 48: fg: unbound variable looks abnormal in your terminal spew.

Can you check ~/.local/share/Steam/logs/steamwebhelper.txt for any hints and attach it as a file or gist if there's anything that looks like a decent hint? Also, please copy your system information from Steam (Steam -> Help -> System Information) and put it in a gist, then include a link to the gist in this issue report.

~Blind guess that this is a steam-native-runtime related issue. Can you completely close Steam, then run steam-runtime from a terminal and confirm that Steam behaves the same?~

Ssmcv 2021-09-10 github

steamwebhelper.sh: line 48: fg: unbound variable

The steamwebhelper.sh in Steam build 1631237534 (Sep 10 2021, 01:00:50) doesn't seem to mention a variable named fg on line 48 (or anywhere, in fact). Have you modified that script?

Here's what I would expect to find in ~/.steam/root/ubuntu12_64/steamwebhelper.sh: https://gist.github.com/smcv/b4f4f18f127c8893c05604c8753e280f

Ssmcv 2021-09-10 github

One thing that could be happening here is that in the unsupported case where the Steam Runtime is disabled, we would set in_runtime=(); and in some older versions of bash, ${an_empty_array[@]} is considered to be an error under set -u.

However, if that's what is happening, then I would expect to have seen the message Runtime for steamwebhelper: disabled by environment (this is unsupported), and then, later, ${in_runtime[@]}: unbound variable. Also, I would not have expected Arch to have an old version of bash.

(At the risk of repeating myself, disabling the Steam Runtime with mechanisms like steam-native is unsupported.)

Ssmcv 2021-09-10 github

Blind guess that this is a steam-native-runtime related issue

This doesn't look like steam-native to me, actually.

The log says STEAM_RUNTIME is enabled automatically, and then, later, Runtime for steamwebhelper: defaulting to /home/rixx/.local/share/Steam/ubuntu12_64/steam-runtime-heavy, which both match what I get with the Steam Runtime enabled (as it is meant to be).

Rrixx 2021-09-10 github

Can you check ~/.local/share/Steam/logs/steamwebhelper.txt for any hints and attach it as a file or gist if there's anything that looks like a decent hint?

@kisak-valve That file does not exist for me.

My steam system information is here.

The steamwebhelper.sh in Steam build 1631237534 (Sep 10 2021, 01:00:50) doesn't seem to mention a variable named fg on line 48 (or anywhere, in fact). Have you modified that script?

I have not modified that script, and in fact, my script matches the one you posted completely.

As you mentioned bash, I tried executing steam with bash (I usually use zsh), but nothing changed.

Ssmcv 2021-09-14 github

Can you check ~/.local/share/Steam/logs/steamwebhelper.txt for any hints

It's steamwebhelper.log, not steamwebhelper.txt. Please check whether that file exists, and if so, what's in it?

As you mentioned bash, I tried executing steam with bash (I usually use zsh), but nothing changed.

This is not directly related to your chosen interactive shell. steamwebhelper.sh is a #!/bin/bash script, so it will always be run by /bin/bash - Steam is using bash as a scripting language (for which alternatives include Python or Perl), rather than as an interactive shell (for which alternatives include zsh or csh).

I have not modified that script, and in fact, my script matches the one you posted completely.

OK, this is weird. If your script is unmodified, then I don't know where the message steamwebhelper.sh: line 48: fg: unbound variable could be coming from - there's no fg on line 48!

Do you perhaps have some strange shell aliases set up?

If I'm reading the bash man page correctly, all the usual configuration files like ~/.bashrc and /etc/profile are only read for interactive shells (which this isn't) and/or login shells (which this isn't). However, if you have the BASH_ENV environment variable set to the path to a file, then that file will be sourced during startup of any instance of bash, including ours.

Do you perhaps have BASH_ENV set to a file that contains function definitions or alias commands? If yes, does one of them perhaps redefine the meaning of exec?

Rrixx 2021-09-14 github

It's steamwebhelper.log, not steamwebhelper.txt. Please check whether that file exists, and if so, what's in it?

No file starting with steam* at all is in that directory (though lots of other log/txt files). Nothing in /.steam/steam/logs/, either.

If your script is unmodified, then I don't know where the message steamwebhelper.sh: line 48: fg: unbound variable could be coming from - there's no fg on line 48!

That's true and confusing. Upon further testing (as well as I can), the issue seems to be the set -x itself. Which I really don't understand.

I can't modify the script without steam resetting it on startup, naturally, so I tried the following:

  1. start steam, see the unbound variable error as detailed above, and an empty browser interface
  2. edit steamwebhelper.sh to remove the set -x line
  3. run steamwebhelper.sh
  4. wait/jump between locations a bit in steam
  5. the steam web interface shows up

I'm really not sure what's going on with set -x here: BASH_ENV is empty.

Rrixx 2021-09-14 github

Alright, solved: Executing with PS4="" solves the problem. Apologies for the issue and thank you for your help in nailing this down.

Ssmcv 2021-09-14 github

Did your PS4 have variable references in it, or something?

We should probably drop the set -x from steamwebhelper.sh regardless, that was a leftover from debugging and wasn't really intended to ship. @TTimo, perhaps you could take out the set -x?

TTTimo 2021-09-14 github

sure

Rrixx 2021-09-14 github

Yeah, PS4 had external references, which worked in zsh, so I never noticed it broke other things.

Ssmcv 2021-09-14 github

External references in PS4 work in bash too, but not if you are using set -u to detect broken assumptions (references to unset variables without a guard). Many scripts use set -u as a way to increase robustness, as part of "unofficial strict mode".

You can avoid PS4 breaking external scripts by using the syntax ${foo-} rather than ${foo}, which expands to the value of foo if set, or expands to nothing (empty string) if foo is unset.

Nothing extracted yet.