Announcing: KornShell 93u+m 1.0.0-beta.2
https://github.com/ksh93/ksh
- The 'return' command, when used to return from a function, can now
return any status value in the 32-bit signed integer range, like on
zsh. However, due to a traditional Unix kernel limitation, $? is
still trimmed to its least significant 8 bits whenever leaving a
(sub)shell environment.
I'll have a look into the details soon, but this one irritated me;
but maybe I just misunderstood it:
- The 'return' command, when used to return from a function, can now
return any status value in the 32-bit signed integer range, like on
zsh. However, due to a traditional Unix kernel limitation, $? is
still trimmed to its least significant 8 bits whenever leaving a
(sub)shell environment.
If in Kornshell I terminate a process with a signal I get a number
returned that is beyond the 8 bit range; e.g. a kill (with SIGTERM)
results in $? evaluating to 271.
What the announcement item above means instead is this:
$ myfunc() { return 12345; }
$ myfunc; echo $?
12345
$ (myfunc); echo $?
57
$ ksh -c 'myfunc() { return 12345; }; myfunc'; echo $?
57
i.e., the exit status of a subshell or child shell that invokes
'myfunc', and does nothing to overwrite $? before exiting, is the least significant 8 bits of 12345, i.e., 12345 % 0xFF == 210.
On Fri, 17 Dec 2021 11:18:26 +0100
Martijn Dekker <martijn@inlv.demon.nl> wrote:
What the announcement item above means instead is this:
$ myfunc() { return 12345; }
$ myfunc; echo $?
12345
$ (myfunc); echo $?
57
$ ksh -c 'myfunc() { return 12345; }; myfunc'; echo $?
57
i.e., the exit status of a subshell or child shell that invokes
'myfunc', and does nothing to overwrite $? before exiting, is the least
significant 8 bits of 12345, i.e., 12345 % 0xFF == 210.
For the least significant 8 bits of 12345 the calculation you want is
12345 % 256 == 57 .Regardless , 12345 % 0xFF == 105 .
Announcing: KornShell 93u+m 1.0.0-beta.2
https://github.com/ksh93/ksh
[...]
Please download the source code tarball from our GitHub releases page:
https://github.com/ksh93/ksh/releases
To build, follow the instructions in README.md or src/cmd/ksh93/README.
On 17.12.2021 04:38, Martijn Dekker wrote:
Announcing: KornShell 93u+m 1.0.0-beta.2
https://github.com/ksh93/ksh
[...]
Please download the source code tarball from our GitHub releases page:
https://github.com/ksh93/ksh/releases
To build, follow the instructions in README.md or src/cmd/ksh93/README.
I tried a build of the shell, and after a long seamless running compile
got an error. (I seem to recall that I detected it already in a previous release.)
Note: in the logs below I replaced the actual top level directory by ~ .[...]
+ ~/ksh/arch/linux.i386-64/bin/ar x -lsum sumlib.o
/usr/bin/ar: two different operation options specified
mamake [lib/libcmd]: *** exit code 1 making sumlib.o
mamake: *** exit code 1 making lib/libcmd
mamake: *** exit code 1 making all
Got the usage info from the packaged ar (no idea where the -U thing
comes from, and why a different path for ar is displayed)
~/ksh/arch/linux.i386-64/bin/ar --help
/usr/bin/ar: invalid option -- 'U'
Usage: /usr/bin/ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
/usr/bin/ar -M [<mri-script]
If you can confirm that deleting the wrapper script fixes your build
failure, I'll get rid of it and see if anything breaks for anyone else.
[...]
If you delete the wrapper script in both places
$ rm src/cmd/INIT/ar.linux.i386-64 arch/linux.i386-64/bin/ar
and then try 'bin/package make' again, does it build?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 239:54:17 |
Calls: | 6,624 |
Files: | 12,173 |
Messages: | 5,320,014 |