DTLSPAWN fails with tcsh-invocation error

Discussion of the COZBATCH utility for z/OS
Post Reply
Ulrich Schmidt
Posts: 37
Joined: Fri Jan 09, 2009 1:25 pm
Location: Germany

DTLSPAWN fails with tcsh-invocation error

Post by Ulrich Schmidt »

Hi,

when running DTLSPAWN, I get the STDERR:
Unknown option: `-L'
Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].

in any case; even with jcl like this:
//EX1 EXEC DTLSPAWN
//STDIN DD *
env

STDOUT is:
DtlSpawn[N]: Copyright (C) 2005-2006 Dovetailed Technologies LLC. All rights reserved.
DtlSpawn[N]: version 1.0.9 2008-09-24
DtlSpawn: executing progname=login-shell="/bin/tcsh"
DtlSpawn: returning with rc=exitcode=1

The used procedure looks this (after conversion):
XXDTLSPAWN PROC LOGLVL='',
XX CMD='',
XX LIBRARY='SYS1.COZ.LOADLIB',
XX REGSIZE='32M',
XX LEPARM=''
XXSPAWN EXEC PGM=DTLSPAWN,REGION=&REGSIZE,
XX PARM='&LEPARM/&LOGLVL &CMD'
IEFC653I SUBSTITUTION JCL - PGM=DTLSPAWN,REGION=32M,PARM='/ '
XXSTEPLIB DD DSN=&LIBRARY,DISP=SHR
IEFC653I SUBSTITUTION JCL - DSN=SYS1.COZ.LOADLIB,DISP=SHR
XXSYSOUT DD SYSOUT=*
XXSTDENV DD DUMMY
//STDIN DD *
X/STDIN DD DUMMY
XXSTDOUT DD SYSOUT=*
XXSTDERR DD SYSOUT=*
XX PEND
//*

This job fails only on three of our systems making up a sysplex. There are no problems running them on other systems.

Any idea about this?

Ulrich
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The default program launched by DTLSPAWN is the user's login shell with the "-L" flag, which for /bin/sh and bash means a "login" shell. For tcsh, "-L" apparently isn't recognized. We need to figure out a way to change the code so that it uses "-" as argv[0] which all shells should recognize, but last time I looked this was a little tricky when doing a local spawnp().

In the mean time, if you are using tcsh as your shell, you can probably do this to get a tcsh login shell:

// EXEC DTLSPAWN,CMD='/bin/tcsh -l'

Please let me know if this works as a temporary workaround for you.
Ulrich Schmidt
Posts: 37
Joined: Fri Jan 09, 2009 1:25 pm
Location: Germany

Post by Ulrich Schmidt »

The circumvention works fine. Thank. Nevertheless I don't know where this calling tcsh stems from. We normally don't use this. The "PROGRAM"-definiton for my userid is '/bin/sh' - the same as on all other systems.
Ulrich
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

That is very curious. DTLSPAWN looks up the user's login shell using code like this:

Code: Select all

struct passwd *pw;
		pw = getpwuid(geteuid());
		if (pw && pw->pw_shell && strlen(pw->pw_shell) > 0) {
			argv[0] = progname = strdup(pw->pw_shell);
			LOG(LOG_INFO, "executing progname=login-shell=\"%s\"", progname);
		} else {
			LOG(LOG_INFO, "executing default progname=\"%s\"", progname);
		} 		
From the messages in your log, it does appear that the default shell is configured as tcsh.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Co:Z 1.2.1 has been updated to start the user's login shell with argv[0] set to a dash followed by the shell name. By convention, all shells should recognize this as a login shell.
Post Reply