Bug 19926 - tcsh has strange login shell detection
tcsh has strange login shell detection
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: tcsh (Show other bugs)
7.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Eido Inoue
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-10-27 12:39 EDT by Tobias Ringstrom
Modified: 2007-04-18 12:29 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-06 16:36:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tobias Ringstrom 2000-10-27 12:39:39 EDT
All shells I know of start as a login shell (reading .profile, .login or
whatever) when the first character of argv[0] is a dash ('-'). However,
tcsh does become a login shell if there are any arguments. I cannot see any
good reason for this. The following patch makes tcsh behave, and
automatically fixes the bugs with gdm not reading .login for tcsh users.

/Tobias

--- sh.c.orig	Fri Aug 13 18:32:51 1999
+++ sh.c	Fri Oct 27 18:29:09 2000
@@ -297,7 +297,6 @@
     gid = getgid();
     euid = geteuid();
     egid = getegid();
-#if defined(OREO) || defined(DT_SUPPORT)
     /*
      * We are a login shell if: 1. we were invoked as -<something> with
      * optional arguments 2. or we were invoked only with the -l flag
@@ -305,15 +304,6 @@
     loginsh = (**tempv == '-') || (argc == 2 &&
 				   tempv[1][0] == '-' && tempv[1][1] == 'l' &&
 						tempv[1][2] == '\0');
-#else
-    /*
-     * We are a login shell if: 1. we were invoked as -<something> and we
had
-     * no arguments 2. or we were invoked only with the -l flag
-     */
-    loginsh = (**tempv == '-' && argc == 1) || (argc == 2 &&
-				   tempv[1][0] == '-' && tempv[1][1] == 'l' &&
-						tempv[1][2] == '\0');
-#endif
 
 #ifdef _VMS_POSIX
     /* No better way to find if we are a login shell */
Comment 1 Eido Inoue 2001-02-06 16:36:51 EST
bash will also allow optional arguments even when arg0 is '-', so this seems
resonable. Will allowing the login shell to accept arguments break any tcsh
scripts out there?

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