1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/sh
Martijn Dekker 83baa27ef9 Fix incorrect typeset -L/-R/-Z on input with spaces (re: bdb99741)
The typeset output for -L/-R/-Z seems to be wrong when the input
has leading/trailing spaces. This started occurring after the
dynamic buffer size changes introduced in name.c as part of the
fix for <https://github.com/ksh93/ksh/issues/142>.

Test script:
  typeset -L8  s_date1=" 22/02/09 08:25:01"; echo "$s_date1"
  typeset -R10 s_date1="22/02/09 08:25:01 "; echo "$s_date1"
  typeset -Z10 s_date1="22/02/09 08:25:01 "; echo "$s_date1"

Actual output:
22/02/0
  08:25:01
0008:25:01

Expected output:
22/02/09
9 08:25:01
9 08:25:01

src/cmd/ksh93/sh/name.c: nv_newattr():
- Simplify allocation code, replacing the earlier dynamic buffer
  size calculation with just the greater of the strlen and size.

Resolves: https://github.com/ksh93/ksh/issues/476
Co-authored-by: George Lijo <george.lijo@gmail.com>
2022-05-26 00:08:45 +01:00
..
args.c posix mode: disable effect of repeating whitespace char in $IFS 2022-03-11 21:22:22 +01:00
arith.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
array.c Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF 2022-02-10 21:04:56 +00:00
defs.c [shp cleanup 00] Reunify the original sh state struct 2022-01-01 02:28:06 +00:00
deparse.c INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
expand.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
fault.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
fcin.c INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
init.c posix mode: disable effect of repeating whitespace char in $IFS 2022-03-11 21:22:22 +01:00
io.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
jobs.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
lex.c Fix line continuation within command substitutions 2022-05-22 00:23:54 +01:00
macro.c Fix a few minor issues (#473) 2022-03-11 21:18:42 +01:00
main.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
name.c Fix incorrect typeset -L/-R/-Z on input with spaces (re: bdb99741) 2022-05-26 00:08:45 +01:00
nvdisc.c Fix a few minor issues (#473) 2022-03-11 21:18:42 +01:00
nvtree.c Fix a few minor issues (#473) 2022-03-11 21:18:42 +01:00
nvtype.c Fix a few minor issues (#473) 2022-03-11 21:18:42 +01:00
parse.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
path.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
pmain.c INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
shcomp.c Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
streval.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
string.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
subshell.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
suid_exec.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
tdump.c Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF 2022-02-10 21:04:56 +00:00
timers.c Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
trestore.c Fix the output of typeset -p for two dimensional indexed arrays (#454) 2022-02-10 21:01:40 +00:00
waitevent.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
xec.c Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00