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

On v1.13.0, calls with _fg=False fail with error "TypeError: Invalid special arguments: 'fg': _fg is invalid with nearly every other option" #520

Closed
Nicolas-Duboc-IBM opened this issue Apr 28, 2020 · 1 comment
Assignees
Labels

Comments

@Nicolas-Duboc-IBM
Copy link

Nicolas-Duboc-IBM commented Apr 28, 2020

In 1.13.0, the new fg_validator considers only if the _fg arg is in the passed arguments without considering if the value of the arg is True :
https://github.com/amoffat/sh/blob/1.13.0/sh.py#L1107

This makes it refuse legitimate calls like sh.ls(*args, _out=self.process_line, _err=self.process_line, _fg=False)` .

@amoffat
Copy link
Owner

amoffat commented Apr 28, 2020

Thanks for reporting. This is fixed on1.13.1 with e2cb020, please upgrade.

@amoffat amoffat closed this as completed Apr 28, 2020
apatard added a commit to apatard/molecule that referenced this issue Apr 29, 2020
Since sh.py 1.13, a new check on the environment variables has been added
with commit amoffat/sh@5b27477.

This leads to failures in the testsuite since the code is passing
os.environ, which is not a dict().

It's also breaking MOLECULE_ENV_FILE handling with errors like (from the testsuite):

E           TypeError: Invalid special arguments:
E
E             'env': value None of env key 'MOLECULE_ENV_FILE' must be a str

so:
- use dict() to convert os.environ to a dict in _rebake_command(),
- use str() when defining MOLECULE_ENV_FILE to make sure self.env_file is a string.

To avoid any other surprise with 1.14 or newer, I've changed the sh.py requirement
to < 1.14. The requirement is not 1.13 but 1.13.1 to get the fix for sh.py bug ansible#520
(amoffat/sh#520).

Signed-off-by: Arnaud Patard <apatard@hupstream.com>
bmwiedemann added a commit to bmwiedemann/openSUSE that referenced this issue Jun 17, 2020
https://build.opensuse.org/request/show/815418
by user StevenK + dimstar_suse
- Update to 1.13.1:
  * regression fix if `_fg=False` [#520](amoffat/sh#520)
  * minor Travis CI fixes [#492](amoffat/sh#492)
  * bugfix for boolean long options not respecting `_long_prefix` [#488](amoffat/sh#488)
  * fix deprecation warning on Python 3.6 regexes [#482](amoffat/sh#482)
  * `_pass_fds` and `_close_fds` special kwargs for controlling file descriptor inheritance in child.
  * more efficiently closing inherited fds [#406](amoffat/sh#406)
  * bugfix where passing invalid dictionary to `_env` will cause a mysterious child 255 exit code. [#497](amoffat/sh#497)
  * bugfix where `_in` using 0 or `sys.stdin` wasn't behaving like a TTY, i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants