Bug 19926 - tcsh has strange login shell detection
Summary: tcsh has strange login shell detection
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tcsh (Show other bugs)
(Show other bugs)
Version: 7.0
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Aaron Brown
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-27 16:39 UTC by Tobias Ringstrom
Modified: 2007-04-18 16:29 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Tobias Ringstrom 2000-10-27 16:39:39 UTC
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 21:36:51 UTC
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.