Bug 31830 - csh or tcsh login produces warning messages "consoletype is now deprecated"
Summary: csh or tcsh login produces warning messages "consoletype is now deprecated"
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: All Packagers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-22 06:46 CEST by Ethan Merritt
Modified: 2023-09-19 22:46 CEST (History)
4 users (show)

See Also:
Source RPM: initscripts-10.04-4.mga9.src.rpm
CVE:
Status comment:


Attachments

Description Ethan Merritt 2023-04-22 06:46:56 CEST
Description of problem:

login script /etc/profile.d/lang.csh always emits warning messages:

  warning: consoletype is now deprecated, and will be removed in the near future!
  warning: use tty (1) instead! More info: 'man 1 tty'
  warning: consoletype is now deprecated, and will be removed in the near future!
  warning: use tty (1) instead! More info: 'man 1 tty'

bash logins avoid this by picking up a definition for CONSOLETYPE before executing lang.sh.   It would be nice to make the same happen for csh/tcsh logins.


Version-Release number of selected component (if applicable):


How reproducible:  100%


Steps to Reproduce:
1.  set login shell to tcsh
2.  open a new terminal window, or other instance of login initialization
3.
Comment 1 Lewis Smith 2023-04-22 20:26:18 CEST
Thank you for reporting this.

It looks to be in initscripts, which different packagers maintain, so assigning this globally. Did not find the tsh equivalent of /etc/profile.d/lang.csh

Summary: csh or tcsh login always produces warning messages => csh or tcsh login produces warning messages "consoletype is now deprecated"
Assignee: bugsquad => pkg-bugs

Comment 2 Dave Hodgins 2023-04-22 21:43:27 CEST
(In reply to Lewis Smith from comment #1)
> Thank you for reporting this.
> 
> It looks to be in initscripts, which different packagers maintain, so
> assigning this globally. Did not find the tsh equivalent of
> /etc/profile.d/lang.csh

From "man tcsh" under "Startup and shutdown", tcsh also uses /etc/csh.cshrc
which then sources /etc/profile.d/*.csh

csh is part of the tcsh package.

CC: (none) => davidwhodgins

Juergen Harms 2023-08-29 10:00:06 CEST

CC: (none) => juergen.harms

Comment 3 Fabrice Boyrie 2023-09-18 22:25:11 CEST
I think problem is in initscripts-10.04-7.mga9

in /etc/profile.d/lang.csh (sourced also by tcsh)
line 20

set consoletype=`/sbin/consoletype stdout 2> /dev/null`

If I put instead set consoletype=pty the message disappears. But I suppose it is a bad idea.

CC: (none) => fboyrie

Comment 4 Martin Whitaker 2023-09-18 23:39:50 CEST
(In reply to Fabrice Boyrie from comment #3)
> I think problem is in initscripts-10.04-7.mga9
> 
> in /etc/profile.d/lang.csh (sourced also by tcsh)
> line 20
> 
> set consoletype=`/sbin/consoletype stdout 2> /dev/null`

Indeed, someone has tried to hide the warnings by redirecting stderr to /dev/null, but they have used sh/bash syntax which doesn't work in csh/tcsh. Sadly there isn't a way to redirect stderr on its own in csh/tcsh. I used this for the first occurrence:

  set consoletype=`/sbin/consoletype stdout |& grep -v warning`

and this

  if { /sbin/consoletype fg >& /dev/null } then

for the other two occurrences.

CC: (none) => mageia

Comment 5 Dave Hodgins 2023-09-19 00:02:08 CEST
Perhaps we should replace the use of consoletype as per the msg.

On a pseudo terminal consoletype returns pty while tty returns /dev/pts/$number
On a virtual terminal consoletype returns vt while tty returns /dev/tty$number
I have no idea what tty returns for a serial terminal.

If std input is not connected to a terminal, tty return status is 1.
Comment 6 Martin Whitaker 2023-09-19 22:46:32 CEST
(In reply to Dave Hodgins from comment #5)
> I have no idea what tty returns for a serial terminal.

/dev/ttyS$number

What I don't know is how to determine the type for /dev/console.

Note You need to log in before you can comment on or make changes to this bug.