CARVIEW |
Select Language
HTTP/2 200
date: Fri, 25 Jul 2025 22:28:33 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/ksh93/ksh.git
etag: W/"ce5ef5ce0f523de857eb23cf53ed46fe"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=RKhZAug9aDer%2FnWZEPxP9%2BX9i68OP9%2BDSI3OZ5fJnkSLv93x7gPBvGd2AKNRSpWUw9WuDGde8VUavvPJemF9lbtrVo%2F2aRoFJBHK79FLYDo1JtQt%2FD3ysIH4FQGu9bUn59%2FVUFx0PGq1o3h2A63Ss2eEPJPoB9tT32d3K6b9TxNu5VdoCD621p9bYXFfDYaPRAl03dzktZm8grvMbaUob0e8o3nmuDPNgFmk4UxeZ3WwmTFNkFlk5HLCh3iEK7wR%2BiWLidPXqzvRtbcFLWvVMQ%3D%3D--Rx7fIG6CscIDFzks--rZpLJvax04t225pu0uURAQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.705401473.1753482512; Path=/; Domain=github.com; Expires=Sat, 25 Jul 2026 22:28:32 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sat, 25 Jul 2026 22:28:32 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: CC42:30074E:11D51E:19260E:68840510
Fix typeset -l/-u crash on special vars (rhbz#1083713) · ksh93/ksh@3654ee7 · GitHub
Copy file name to clipboardExpand all lines: src/cmd/ksh93/include/defs.h
Copy file name to clipboardExpand all lines: src/cmd/ksh93/tests/variables.sh
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit 3654ee7
committed
Fix typeset -l/-u crash on special vars (rhbz#1083713)
When using typeset -l or -u on a variable that cannot be changed
when the shell is in restricted mode, ksh crashed.
This fixed is inspired by this Red Hat fix, which is incomplete:
https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20120801-tpstl.patch
The crash was caused by the nv_shell() function. It walks though a
discipline function tree to get the pointer to the interpreter
associated with it. Evidently, the problem is that some pointer in
that walk is not set correctly for all special variables.
Thing is, ksh only has one shell language interpreter, and only one
global data structure (called 'sh') to keep its main state[*]. Yet,
the code is full of 'shp' pointers to that structure. Most (not
all) functions pass that pointer around to each other, accessing
that struct indirectly, ostensibly to account for the non-existent
possibility that there might be more than one interpreter state.
The "why" of that is an interesting cause for speculation that I
may get to sometime. For now, it is enough to know that, in the
code as it is, it matters not one iota what pointer to the shell
interpreter state is used; they all point to the same thing (unless
it's broken, as in this bug).
So, rather than fixing nv_shell() and/or associated pointer
assignments, this commit simply removes it, and replaces it with
calls to sh_getinterp(), which always returns a pointer to sh (see
init.c, where that function is defined as literally 'return &sh').
[*] Defined in shell.h, with the _SH_PRIVATE part in defs.h
src/cmd/ksh93/include/defs.h,
src/cmd/ksh93/sh/name.c:
- Remove nv_shell().
src/cmd/ksh93/sh/init.c:
- In all the discipline functions for special variables, initialise
shp using sh_getinterp() instead of nv_shell().
src/cmd/ksh93/tests/variables.sh:
- Add regression test for typeset -l/-u on all special variables.1 parent 843b546 commit 3654ee7Copy full SHA for 3654ee7
File tree
Expand file treeCollapse file tree
5 files changed
+62
-35
lines changedFilter options
- src/cmd/ksh93
- include
- sh
- tests
Expand file treeCollapse file tree
5 files changed
+62
-35
lines changed+3Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 |
| |
12 | 15 |
| |
13 | 16 |
| |
|
src/cmd/ksh93/include/defs.h
Copy file name to clipboardExpand all lines: src/cmd/ksh93/include/defs.h-1Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
359 | 359 |
| |
360 | 360 |
| |
361 | 361 |
| |
362 |
| - | |
363 | 362 |
| |
364 | 363 |
| |
365 | 364 |
| |
|
+14-14Lines changed: 14 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
230 |
| - | |
| 230 | + | |
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
| |||
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
257 |
| - | |
| 257 | + | |
258 | 258 |
| |
259 | 259 |
| |
260 | 260 |
| |
| |||
278 | 278 |
| |
279 | 279 |
| |
280 | 280 |
| |
281 |
| - | |
| 281 | + | |
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
| |||
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
306 |
| - | |
| 306 | + | |
307 | 307 |
| |
308 | 308 |
| |
309 | 309 |
| |
| |||
345 | 345 |
| |
346 | 346 |
| |
347 | 347 |
| |
348 |
| - | |
| 348 | + | |
349 | 349 |
| |
350 | 350 |
| |
351 | 351 |
| |
| |||
369 | 369 |
| |
370 | 370 |
| |
371 | 371 |
| |
372 |
| - | |
| 372 | + | |
373 | 373 |
| |
374 | 374 |
| |
375 | 375 |
| |
| |||
494 | 494 |
| |
495 | 495 |
| |
496 | 496 |
| |
497 |
| - | |
| 497 | + | |
498 | 498 |
| |
499 | 499 |
| |
500 | 500 |
| |
| |||
573 | 573 |
| |
574 | 574 |
| |
575 | 575 |
| |
576 |
| - | |
| 576 | + | |
577 | 577 |
| |
578 | 578 |
| |
579 | 579 |
| |
| |||
657 | 657 |
| |
658 | 658 |
| |
659 | 659 |
| |
660 |
| - | |
| 660 | + | |
661 | 661 |
| |
662 | 662 |
| |
663 | 663 |
| |
| |||
681 | 681 |
| |
682 | 682 |
| |
683 | 683 |
| |
684 |
| - | |
| 684 | + | |
685 | 685 |
| |
686 | 686 |
| |
687 | 687 |
| |
| |||
691 | 691 |
| |
692 | 692 |
| |
693 | 693 |
| |
694 |
| - | |
| 694 | + | |
695 | 695 |
| |
696 | 696 |
| |
697 | 697 |
| |
| |||
934 | 934 |
| |
935 | 935 |
| |
936 | 936 |
| |
937 |
| - | |
| 937 | + | |
938 | 938 |
| |
939 | 939 |
| |
940 | 940 |
| |
| |||
945 | 945 |
| |
946 | 946 |
| |
947 | 947 |
| |
948 |
| - | |
| 948 | + | |
949 | 949 |
| |
950 | 950 |
| |
951 | 951 |
| |
| |||
966 | 966 |
| |
967 | 967 |
| |
968 | 968 |
| |
969 |
| - | |
| 969 | + | |
970 | 970 |
| |
971 | 971 |
| |
972 | 972 |
| |
|
-11Lines changed: 0 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3624 | 3624 |
| |
3625 | 3625 |
| |
3626 | 3626 |
| |
3627 |
| - | |
3628 |
| - | |
3629 |
| - | |
3630 |
| - | |
3631 |
| - | |
3632 |
| - | |
3633 |
| - | |
3634 |
| - | |
3635 |
| - | |
3636 |
| - | |
3637 |
| - | |
3638 | 3627 |
| |
3639 | 3628 |
| |
3640 | 3629 |
| |
|
src/cmd/ksh93/tests/variables.sh
Copy file name to clipboardExpand all lines: src/cmd/ksh93/tests/variables.sh+45-9Lines changed: 45 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
868 | 868 |
| |
869 | 869 |
| |
870 | 870 |
| |
871 |
| - | |
| 871 | + | |
872 | 872 |
| |
873 | 873 |
| |
874 | 874 |
| |
| |||
954 | 954 |
| |
955 | 955 |
| |
956 | 956 |
| |
957 |
| - | |
958 |
| - | |
| 957 | + | |
| 958 | + | |
959 | 959 |
| |
960 | 960 |
| |
961 | 961 |
| |
| |||
984 | 984 |
| |
985 | 985 |
| |
986 | 986 |
| |
987 |
| - | |
988 |
| - | |
| 987 | + | |
| 988 | + | |
989 | 989 |
| |
990 | 990 |
| |
991 | 991 |
| |
| |||
1008 | 1008 |
| |
1009 | 1009 |
| |
1010 | 1010 |
| |
1011 |
| - | |
1012 |
| - | |
| 1011 | + | |
| 1012 | + | |
1013 | 1013 |
| |
1014 | 1014 |
| |
1015 | 1015 |
| |
| |||
1025 | 1025 |
| |
1026 | 1026 |
| |
1027 | 1027 |
| |
1028 |
| - | |
1029 |
| - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1030 | 1066 |
| |
1031 | 1067 |
| |
1032 | 1068 |
| |
|
You can’t perform that action at this time.
0 commit comments