Opened 12 years ago

Last modified 2 years ago

#36682 assigned defect

ksh93: typeset does not localize shell variable inside function

Reported by: ruttenberg@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port: ksh93

Description

When a shell variable is "typeset" inside a function, changing the value inside the function should not affect the value of the variable outside of the function. This feature works properly in Solaris.

Attachments (2)

test (398 bytes) - added by ajdudman 9 years ago.
test.out (490 bytes) - added by ajdudman 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by ruttenberg@…

Cc: ruttenberg@… added

Cc Me!

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added; ruttenberg@… removed

I am not sure what to do about this, other than try to update ksh93 to a newer version, but of the newer versions I tried, I couldn't get them to build. What version is working for you on Solaris?

Changed 9 years ago by ajdudman

Attachment: test added

Changed 9 years ago by ajdudman

Attachment: test.out added

comment:3 Changed 9 years ago by ajdudman

This works properly for me. Maybe there is confusion between "function f" and "g()" style functions. The former has locally-scoped variables with the typeset builtin, (unless invoked with the . special builtin). The latter has shared variables. Or maybe it's expecting ksh to behave similarly to bash. Read ksh(1) man page below the "Functions." heading. Bash compatibility is under development, but may be tried by invoking ksh by the linked name "bash" or "ksh -o bash". A test script and its output are attached.

Version 0, edited 9 years ago by ajdudman (next)

comment:4 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

I've updated the ksh93 port to the latest version as of today, 20181007. Please try installing this version. If it still has the problem, please report it to the ksh developers.

comment:5 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign removed
Owner: changed from macports-tickets@… to ryandesign
Status: newassigned
Summary: ksh93; typeset does not localize shell variable inside functionksh93: typeset does not localize shell variable inside function

The 2018-2020 ksh development effort was abandoned and the ksh93 port was returned to the previous 93u+2012-08-01 version.

Development of ksh93 has resumed in the ksh93u+m fork. If the reported problem is still occurring with ksh93, please check whether the ksh93-devel port exhibits the same problem. If so, please report it to the developers of that fork. I expect to update the ksh93 port to that fork once it reaches a stable milestone.

Note: See TracTickets for help on using tickets.