Open tfpf opened 4 weeks ago
This seems like a bug in the underlying shellingham that we (and poetry ) use.
@oz123 Would it be possible for you to provide some code showing why that is the case? I can file bug with Shellingham if required.
Sorry, on a second thought, it's probably not shelling ham. When you run pipenv shell, it's calling shelling ham to detect the shell, and then it calls pexpect.
https://github.com/pypa/pipenv/blob/7493d181b2ede1bf5820189c128020d156cb51f2/pipenv/shells.py#L102
This seems to cause the error:
c = pexpect.spawn(self.cmd, ["-i"], dimensions=(dims.lines, dims.columns))
Issue description
If
COLUMNS
is exported prior to starting a Pipenv shell in Bash, it does not get updated upon resizing the terminal window, even if thecheckwinsize
Bash setting is enabled.Expected result
If the terminal window is resized,
COLUMNS
should get updated, irrespective of whether Bash is running in a normal shell or a Pipenv shell, or if it has been exported.Actual result
COLUMNS
does not get updated in a Pipenv shell if it has been exported.Steps to replicate
Pipfile
is required, since Pipenv creates one.) Ensure that it is running Bash.shopt -s checkwinsize
.export COLUMNS
.echo $COLUMNS
. Repeat a couple of times. The output of the command reflects the width of the terminal.pipenv shell
.shopt -s checkwinsize
(just to be sure).echo $COLUMNS
. Repeat a couple of times. The output of the command does not reflect the width of the terminal; it remains fixed.Additional Information
In step 5, instead of running
pipenv shell
, if I:bash
, or. ~/.local/share/virtualenvs/path-to-venv/bin/activate
,then there is no issue:
COLUMNS
gets updated as expected. Which leads me to believe this is a Pipenv issue. I cleared~/.bashrc
prior to executing all of the above steps. I am using GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu).See also
which discuss the same issue with Poetry. They mention this is not observed with Pipenv; however, if
COLUMNS
is exported, Pipenv suffers from the same problem.$ pipenv --support
Pipenv version: `'2023.12.1'` Pipenv location: `'/usr/lib/python3.12/site-packages/pipenv'` Python location: `'/usr/bin/python'` OS Name: `'posix'` User pip version: `'23.3.2'` user Python installations found: PEP 508 Information: ``` {'implementation_name': 'cpython', 'implementation_version': '3.12.3', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '6.6.32-1-lts', 'platform_system': 'Linux', 'platform_version': '#1 SMP PREEMPT_DYNAMIC Sat, 25 May 2024 20:20:51 +0000', 'python_full_version': '3.12.3', 'python_version': '3.12', 'sys_platform': 'linux'} ``` System environment variables: - `SHELL` - `SESSION_MANAGER` - `WINDOWID` - `COLORTERM` - `XDG_SESSION_PATH` - `GNOME_DESKTOP_SESSION_ID` - `LC_ADDRESS` - `LC_NAME` - `CINNAMON_VERSION` - `DESKTOP_SESSION` - `LC_MONETARY` - `GTK_MODULES` - `XDG_SEAT` - `PWD` - `LOGNAME` - `XDG_SESSION_DESKTOP` - `QT_QPA_PLATFORMTHEME` - `XDG_SESSION_TYPE` - `XAUTHORITY` - `XDG_GREETER_DATA_DIR` - `GJS_DEBUG_TOPICS` - `MOTD_SHOWN` - `HOME` - `LC_PAPER` - `LANG` - `XDG_CURRENT_DESKTOP` - `VTE_VERSION` - `XDG_SEAT_PATH` - `GJS_DEBUG_OUTPUT` - `XDG_SESSION_CLASS` - `TERM` - `LC_IDENTIFICATION` - `USER` - `DISPLAY` - `SHLVL` - `LC_TELEPHONE` - `LC_MEASUREMENT` - `XDG_VTNR` - `XDG_SESSION_ID` - `XDG_RUNTIME_DIR` - `DEBUGINFOD_URLS` - `LC_TIME` - `GTK3_MODULES` - `PATH` - `GDMSESSION` - `DBUS_SESSION_BUS_ADDRESS` - `MAIL` - `GIO_LAUNCHED_DESKTOP_FILE_PID` - `GIO_LAUNCHED_DESKTOP_FILE` - `LC_NUMERIC` - `_` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PYTHONDONTWRITEBYTECODE` - `PYTHONFINDER_IGNORE_UNSUPPORTED` Pipenv–specific environment variables: Debug–specific environment variables: - `PATH`: `/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl` - `SHELL`: `/bin/bash` - `LANG`: `en_GB.UTF-8` - `PWD`: `/home/tfpf/Documents/projects/pipenv-bug` --------------------------- Contents of `Pipfile` ('/home/tfpf/Documents/projects/pipenv-bug/Pipfile'): ```toml [[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] [dev-packages] [requires] python_version = "3.12" ```