Zsh Mailing List Archive
Messages sorted by:
Re: 'export -p' lacks POSIX output
- X-seq: zsh-workers 39713
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: 'export -p' lacks POSIX output
- Date: Sun, 23 Oct 2016 09:47:00 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=LQwGdYzv+BHWcRzidzBuO4WiG2vv4sbJlwe/wf5gEk0=; b=Onq5vLuLKiaYAz83GjumwXsgF0NRXEFBjQRr7P0Oo5sIvWzhQqOSpaS1fC00vWw81h 8gPQWfmDXFEs38WXZrigO+1wcskKmDyCpaPOSpmJpnAAFhw2csepNO01NaIIa+PQzwGT OHwoaOWhceZiIQ0ztG4WzGdysDsmIwM6Za6LShiKBBOQp4ZS0hubnDtBp48ZygG07zaf XE2RNyeEnrcY8vRRCDDEL5HpL8a3YuVMzu+8GCT1NqMyiYsUnxM099vDp5VocqWzUabd GvHu1uydmD4Y8+R9VfPXrmuTGnPjFN2ty40HuaKRT1wA8+rt3mW31uacdG9nCY2/zut6 0CSA==
- In-reply-to: <firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <email@example.com> <161022112423.ZM6178@torch.brasslantern.com> <firstname.lastname@example.org>
On Oct 23, 2:00pm, Martijn Dekker wrote:
} Subject: Re: 'export -p' lacks POSIX output
} Op 22-10-16 om 20:24 schreef Bart Schaefer:
} > Would anyone object if this just happened all the time, rather than
} > depending on POSIXBUILTINS + "export"?
} After the patch, variables with a non-scalar type get output such as:
} export -i10 SHLVL=2
} Option flags to 'export' other than -p are not POSIX, and POSIX
} specifies output without any flags for 'export -p'.
We may have to settle for incompatibility here. As I mentioned, there
is no way (without either a large code change or introducing yet another
global variable [*]) for the code that prints the command name to know
whether "typeset -p", "declare -p", "export -p", etc. were used. If the
non-string (note, integer is not non-scalar) flags are eliminated, the
state won't be properly reflected if the commands are re-input.
If you're writing a POSIX-compatible script you shouldn't declare anything
integer in the first place, should you?
} In any case, if the output needs to be conditional upon POSIXBUILTINS
} anyway, I reckon you might as well not change the behaviour at all if
} POSIXBUILTINS is not active.
The selection of the command name to print and the output of the type
dinstinction flags are in separate sections of the code, so that's not
really a concern. I think the addition of -g for typeset of non-local
parameters in function scope is useful (waiting to hear if anyone has
objections) and that doesn't depend on POSIXBUILTINS.
[*] Of course if such a variable WERE introduced I could take advantage
of it in zsh/param/private. I was trying to avoid invasive changes for
that module but if it's needed for other reasons I'd be less shy.
Messages sorted by: