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

conda.csh sets $prompt for non-interactive ssh #9281

Closed
nealdevine opened this issue Sep 25, 2019 · 1 comment · May be fixed by #13967
Closed

conda.csh sets $prompt for non-interactive ssh #9281

nealdevine opened this issue Sep 25, 2019 · 1 comment · May be fixed by #13967
Labels
cli::tcsh pertains to the CLI in tcsh/CSH locked [bot] locked due to inactivity source::community catch-all for issues filed by community members stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity type::bug describes erroneous operation, use severity::* to classify the type

Comments

@nealdevine
Copy link

nealdevine commented Sep 25, 2019

Current Behavior

I scp or run non-interactive ssh command to a user@host with user having tcsh shell.
The system runs /etc/csh.cshrc which calls /etc/profile.d/*.csh including conda.csh (conda/shell/etc/profile.d/conda.csh) which I believe causes $?prompt to be true via the set prompt="" line. Next my home dir .cshrc is called which if $?prompt and ! $?TERM it calls setenv TERM `tset -Q -` which results in a error with message "tset: standard error: Inappropriate ioctl for device".
(I've removed that code from my .cshrc to work around this.)

Steps to Reproduce

# Run non-interactive ssh for user with tcsh shell on hosts with/without conda.csh:
ssh -q tcshuser@host_with_conda_csh 'echo $?prompt'
1
ssh -q tcshuser@host_wo_conda_csh 'echo $?prompt'
0

Expected Behavior

I believe conda.csh sets $prompt and thus changes $?prompt from 0 to 1 for non-interactive login which it should not. If you see the same behavior, the solution might be to replace line 21:
set prompt=""
with
unset prompt
or to remove the line, but I'm not sure what the purpose of that line is, and it is also possible that some another /etc/profile.d/*.csh on my host is resetting $prompt in which case this is not a bug in conda.csh.

Environment Information

`conda info`


     active environment : None
            shell level : 0
       user config file : /home/v2nrt3/.condarc
 populated config files : /usr/share/conda/condarc.d/defaults.yaml
          conda version : 4.6.13
    conda-build version : not installed
         python version : 3.6.8.final.0
       base environment : /usr  (read only)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /var/cache/conda/pkgs
                          /home/v2nrt3/.conda/pkgs
       envs directories : /home/v2nrt3/.conda/envs
                          /usr/envs
               platform : linux-64
             user-agent : conda/4.6.13 requests/2.12.5 CPython/3.6.8 Linux/3.10.0-957.21.3.el7.x86_64 centos/7.7.1908 glibc/2.17
                UID:GID : 1348:20
             netrc file : None
           offline mode : False

`conda config --show-sources`

==> /usr/share/conda/condarc.d/defaults.yaml <==
pkgs_dirs:
  - /var/cache/conda/pkgs
  - ~/.conda/pkgs

`conda list --show-channel-urls`

EnvironmentLocationNotFound: Not a conda environment: /usr

@kalefranz kalefranz added cli pertains to the CLI interface source::community catch-all for issues filed by community members type::bug describes erroneous operation, use severity::* to classify the type labels Apr 28, 2020
@kenodegard kenodegard added cli::tcsh pertains to the CLI in tcsh/CSH and removed cli pertains to the CLI interface labels Apr 20, 2022
underwoo added a commit to underwoo/conda that referenced this issue Oct 17, 2022
…able, and clear the setting when the script ends if set.

Description
The conda.csh activation script will set the csh prompt variable if not already set. The prompt variable is needed for the activate, deactivate, etc. subcommand. When run in non-interactive shells the current conda.csh script will leave the prompt variable set, which can cause issues for other scripts that run different commands based if the shell is interactive or not.

This fix moves the setting of prompt outside the if/else block, and then unsets the prompt variable if the script did set it.

Fixes conda#9281
@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Apr 21, 2023
@github-actions github-actions bot added the stale::closed [bot] closed after being marked as stale label May 22, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2023
@github-actions github-actions bot added the locked [bot] locked due to inactivity label May 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2024
underwoo added a commit to underwoo/conda that referenced this issue Jun 10, 2024
…able, and clear the setting when the script ends if set.

Description
The conda.csh activation script will set the csh prompt variable if not already set. The prompt variable is needed for the activate, deactivate, etc. subcommand. When run in non-interactive shells the current conda.csh script will leave the prompt variable set, which can cause issues for other scripts that run different commands based if the shell is interactive or not.

This fix moves the setting of prompt outside the if/else block, and then unsets the prompt variable if the script did set it.

Fixes conda#9281
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli::tcsh pertains to the CLI in tcsh/CSH locked [bot] locked due to inactivity source::community catch-all for issues filed by community members stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
3 participants