mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Remove abandoned SHOPT_ENV experiment
SHOPT_ENV is an undocumented compile-time option implementing an experimental method for handling environment variables, which is implemented in env.h and env.c. There is no mention in the docs or Makefile, and no mention in the mailing list archives. It adds no new functionality, but at first glance it's a clean-looking interface. However, unfortunately, it's broken. Compiling with -DSHOPT_ENV added to CCFLAGS causes bin/shtests to show these regressions: functions.sh[341]: export not restored name=value function call -- expected 'base', got '' functions.sh[1274]: Environment variable is not passed to a function substring.sh[236]: export not restored name=value function call variables.sh[782]: SHLVL should be 3 not 2 In addition, 'export' stops working on unset variables. In the 93v- beta this code is still present, unchanged, though 93v- made lots of incompatible changes. By the time ksh2020 noticed it, it was no longer compiling, so it probably wasn't compiling in the 93v- beta either. Discussion: https://github.com/att/ast/issues/504 So the experiment was already abandoned by D. Korn and his team. Meanwhile it was leaving sh/name.c with two versions of several enviornment-related functions, and it's not clear which one is actually compiled without doing detective work tracing header files (most of the code was made conditional on _ENV_H, which is defined in env.h, which is included by defs.h if SHOPT_ENV is defined). This actively hinders understanding of the codebase. And any changes to these functions would need to be implemented twice. src/cmd/ksh93/include/env.h, src/cmd/ksh93/sh/env.c: - Removed. src/cmd/ksh93/DESIGN, src/cmd/ksh93/Makefile, src/cmd/ksh93/Mamfile: - Update accordingly. All other changed files: - Remove deactivated code behind SHOPT_ENV and _ENV_H.
This commit is contained in:
parent
bc4dbe0627
commit
8d7f616e75
10 changed files with 57 additions and 488 deletions
|
@ -53,13 +53,9 @@
|
|||
#define Empty ((char*)(e_sptbnl+3))
|
||||
|
||||
#define env_change() (++ast.env_serial)
|
||||
#if SHOPT_ENV
|
||||
# include <env.h>
|
||||
#else
|
||||
# define Env_t void
|
||||
# define sh_envput(e,p) env_change()
|
||||
# define env_delete(e,p) env_change()
|
||||
#endif
|
||||
#define Env_t void
|
||||
#define sh_envput(e,p) env_change()
|
||||
#define env_delete(e,p) env_change()
|
||||
|
||||
extern char* sh_getenv(const char*);
|
||||
extern char* sh_setenviron(const char*);
|
||||
|
@ -371,9 +367,6 @@ extern int sh_debug(Shell_t *shp,const char*,const char*,const char*,char *cons
|
|||
extern int sh_echolist(Shell_t*,Sfio_t*, int, char**);
|
||||
extern struct argnod *sh_endword(Shell_t*,int);
|
||||
extern char **sh_envgen(void);
|
||||
#if SHOPT_ENV
|
||||
extern void sh_envput(Env_t*, Namval_t*);
|
||||
#endif
|
||||
extern void sh_envnolocal(Namval_t*,void*);
|
||||
extern Sfdouble_t sh_arith(Shell_t*,const char*);
|
||||
extern void *sh_arithcomp(Shell_t *,char*);
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/***********************************************************************
|
||||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1982-2011 AT&T Intellectual Property *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
* *
|
||||
* A copy of the License is available at *
|
||||
* http://www.eclipse.org/org/documents/epl-v10.html *
|
||||
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
||||
* *
|
||||
* Information and Software Systems Research *
|
||||
* AT&T Research *
|
||||
* Florham Park NJ *
|
||||
* *
|
||||
* David Korn <dgk@research.att.com> *
|
||||
* *
|
||||
***********************************************************************/
|
||||
#pragma prototyped
|
||||
#ifndef _ENV_H
|
||||
#define _ENV_H 1
|
||||
|
||||
#ifdef _BLD_env
|
||||
# ifdef __EXPORT__
|
||||
# define export __EXPORT__
|
||||
# endif
|
||||
#else
|
||||
typedef void *Env_t;
|
||||
#endif
|
||||
|
||||
/* for use with env_open */
|
||||
#define ENV_STABLE (-1)
|
||||
|
||||
/* for third argument to env_add */
|
||||
#define ENV_MALLOCED 1
|
||||
#define ENV_STRDUP 2
|
||||
|
||||
extern void env_close(Env_t*);
|
||||
extern int env_add(Env_t*, const char*, int);
|
||||
extern int env_delete(Env_t*, const char*);
|
||||
extern char **env_get(Env_t*);
|
||||
extern Env_t *env_open(char**,int);
|
||||
extern Env_t *env_scope(Env_t*,int);
|
||||
|
||||
#undef extern
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue