From ceda3c4f7654894f96676c093834642b42c3537e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 3 Oct 2023 16:47:14 +0200 Subject: [PATCH] Fix illegal reflective access in exec provider (fixes #862) (#868) --- .../java/org/jline/nativ/JLineLibrary.java | 2 + native/src/main/native/jlinenative.c | 22 ++++ .../jline/nativ/FreeBSD/x86/libjlinenative.so | Bin 4306 -> 4612 bytes .../nativ/FreeBSD/x86_64/libjlinenative.so | Bin 6038 -> 6376 bytes .../jline/nativ/Linux/arm/libjlinenative.so | Bin 7648 -> 7744 bytes .../jline/nativ/Linux/arm64/libjlinenative.so | Bin 8624 -> 8696 bytes .../jline/nativ/Linux/armv6/libjlinenative.so | Bin 8344 -> 8440 bytes .../jline/nativ/Linux/armv7/libjlinenative.so | Bin 7668 -> 7764 bytes .../jline/nativ/Linux/ppc64/libjlinenative.so | Bin 69688 -> 69760 bytes .../jline/nativ/Linux/x86/libjlinenative.so | Bin 14824 -> 14892 bytes .../nativ/Linux/x86_64/libjlinenative.so | Bin 8048 -> 8120 bytes .../nativ/Mac/arm64/libjlinenative.jnilib | Bin 16914 -> 16994 bytes .../jline/nativ/Mac/x86/libjlinenative.jnilib | Bin 8400 -> 8460 bytes .../nativ/Mac/x86_64/libjlinenative.jnilib | Bin 4328 -> 4408 bytes .../jline/nativ/Windows/x86/jlinenative.dll | Bin 86081 -> 86665 bytes .../nativ/Windows/x86_64/jlinenative.dll | Bin 101849 -> 102429 bytes .../org/jline/nativ/JLineLibraryTest.java | 12 +++ .../org/jline/terminal/TerminalBuilder.java | 9 ++ .../impl/exec/ExecTerminalProvider.java | 97 +++++++++++++++--- 19 files changed, 128 insertions(+), 14 deletions(-) diff --git a/native/src/main/java/org/jline/nativ/JLineLibrary.java b/native/src/main/java/org/jline/nativ/JLineLibrary.java index ff1adaa3f..54e002b76 100644 --- a/native/src/main/java/org/jline/nativ/JLineLibrary.java +++ b/native/src/main/java/org/jline/nativ/JLineLibrary.java @@ -23,4 +23,6 @@ public class JLineLibrary { } public static native FileDescriptor newFileDescriptor(int fd); + + public static native ProcessBuilder.Redirect newRedirectPipe(FileDescriptor fd); } diff --git a/native/src/main/native/jlinenative.c b/native/src/main/native/jlinenative.c index 3c3b6489f..7e8711282 100644 --- a/native/src/main/native/jlinenative.c +++ b/native/src/main/native/jlinenative.c @@ -38,4 +38,26 @@ JNIEXPORT jobject JNICALL JLineLibrary_NATIVE(newFileDescriptor)(JNIEnv *env, jc return ret; } +JNIEXPORT jobject JNICALL JLineLibrary_NATIVE(newRedirectPipe)(JNIEnv *env, jclass that, jobject fd) +{ + jfieldID field_fd; + jmethodID const_rpi; + jclass class_rpi; + jobject ret; + class_rpi = (*env)->FindClass(env, "java/lang/ProcessBuilder$RedirectPipeImpl"); + if (class_rpi == NULL) return NULL; + + // construct a new RedirectPipeImpl + const_rpi = (*env)->GetMethodID(env, class_rpi, "", "()V"); + if (const_rpi == NULL) return NULL; + ret = (*env)->NewObject(env, class_rpi, const_rpi); + + // poke the "fd" field with the file descriptor + field_fd = (*env)->GetFieldID(env, class_rpi, "fd", "Ljava/io/FileDescriptor;"); + if (field_fd == NULL) return NULL; + (*env)->SetObjectField(env, ret, field_fd, fd); + + // and return it + return ret; +} diff --git a/native/src/main/resources/org/jline/nativ/FreeBSD/x86/libjlinenative.so b/native/src/main/resources/org/jline/nativ/FreeBSD/x86/libjlinenative.so index de13483f368ceab0e5de6f0d2741a9cc6054a08f..9ad59f06b066563af3f73c6eccf613723053151d 100755 GIT binary patch delta 1411 zcmZ8hU1(ET5T5&M?#*qDNq@Act%)n^y0++xg81SeC<YD{cL~2|70g=*G@u6UqECi{wu6^7Rzd3ua8}=h7-Q2tuXZY zS+DpE`xGzfd|UrTe-YzF{fwTB@oA&eD@2I~c83NcgZW|pY}7g9bEQ(tAU~bssJX#; z2`M?4pPb`8=GIk*`u}P@d@w&-Rg^G~^o?)*&-+jD-u~Sio3xfrgi1pfVA(&GpNL!> z?b+8na3D0GwX`;ulG*+z{<(`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^^lHq2AZM@?N>PU6|XdQ&yrRikz}Fwmh@8U7W_nyR14Fc!*14e46Z%{b>zJ!Z~wRva<&6Blg`D!wcbDP__6jaVN0C;@Apj z%n{jVBOGIq+<$3La@-gBI3R^pju#>WfvUVscbzPkBALKZ*_urU>5pcTvk~%6Bci*s zlgKvwI=a$ zs=;bJ3aS{Z@ffJ8tj6Qu)Mc9&rM(Xlpbpk6@<9@2I9`wM9&XRKi}ctU`Sv<^5Y+i9 zcb_`A_zoOS^mWPu5I0wh6EqnmQKkb)^f8V%6WKzwtwfg`r7)+d6dLD;~uRY^ae{7PbPy0nYL`Vm-sm;XqpLJ+N-cDgfs2`mDK4g zg&)!!*3jMQ) SqTeJbg-+mu)FXVAe)$$6{U#6q diff --git a/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/arm/libjlinenative.so index 9e5f06527121c239e1635bf9dc64cef5751d7b58..f67f1e324d9e5624422afb1afa9ddc1725d63dfc 100755 GIT binary patch delta 1791 zcmZWqZD?C%6h1dM_ck9}o0~K>P2AEZD^97l(`*wOSypv*-59m_W3UO!+Dz|^ZAd>r zndbgb+(5Q;XTSX8&<#XEkq*RdXcguU*<=WcpHS-uRSR~%R7C4@?#<0&JmK8;ecp4< z`*FUqIIxhd#sZhUL>VIT#phBf{fv+3jBjrE;>e}a#eGJ{{=fHbe|Px6>b2qH3sp-M zJupnD1*{O|Eb2Pp^U}`eu8deB3xeCg^j2nh@WIbkE`5Lc*u?PA*Zh!@Q7nE&d7=`A zU4IB4P>7(%fA{> zXa)Ql_h<)n4UaFFc>@uIjNPJowrTiad61rHJYOViK^V9fAL z+ihD)P%?n}F@`bbz!9)S=AX5-$q?4pFv`ZO7?=54+YYUY)hZjImn*WHkcyv>oFb$W zR6xtlGO%+)*-uEd@8X>6U`b}8QeE!khCD(@MGgtc$wI3A2D*o&cAN#t`kOhW+L=VO zsg`4^?F($+<*aMsg{-U<6$R7rF??JeSU^jIoVaI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mi63wr^35OA*qZb~W#`QGQkgXjzOB zXeg@|at`P$yD8VR4D}!@XQ>1!MQh;6?T_tWkvK_?wdqeB6TqTUE*6mptSTDKTb`{O zjn%Kbd$Fi@NCSjX@kdDBdKUO(iaGic+ zhvEyFmf)NJKGrl}-bHm#15LiaHClnVrq>`LUOcH#sWC_gG`ho#p>0;=K8!TqO+~@0 z>M|qsV=T`Y2V{c@Il{aMsG)?Li!1Mh&QM(DLRBCYO8h3PY$);bkBbwyMxioX z=jLia<~qZ1m5YGeS~w;6;6^y;=6s+Wo`=r}DAOJzAtyEaZVzC}NYEn48nr(F%QnBZ diff --git a/native/src/main/resources/org/jline/nativ/Linux/armv6/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/armv6/libjlinenative.so index f31f654a719fcaeeb64928c70cd9edff143b439b..189d638e48b7d047b254b5f7046bd06829ea2ca8 100755 GIT binary patch delta 1776 zcmZ8iO=w(I6h8O8nKzkalFUs0nVHTcnb4rNGeQ$!MZe6H_Z$ zSTahb3YDauKtn+6q6-zo#2`q?!fd)I6{1%AV}ww3A-K?msHGae@4b1$;293*eD|Jv z&b!||_s;V0U&D*-;Z<9tPeeXA*V*m#)`;}hoI8A}r?5Deee32QD_1XWPyYC3rL|*_NXF^aculNQ&BLiR5lwd0J(}xdzuSJtIbNaSnfJSuFK2$64?$#OEsMC1h zsn{yq60{kqX=n6Q;CfTu5@~{lpxdZ$#fUBh*31PR4mQQ-G13psK?BfEqt695?|otH z)v;W0?4{>(M`owT3nxyDoSZ676lSy4`+Dg3Oi>Wb@US-kI{f+xOMlnauGx#W;PzjhPc1uq-?!A8!!7-pbY#jChXcLsD_V4cQ zbQI&euq^N!>>d5GaVU5iqo*|%JrifEWHHC0T!W$?MfcQ}0P$I}Bg<8Hyw z5+~4sZMqfD%yZ`y8$SwnPO;02$cTr@kI0=0CQs-cZyDm*#~w$tw!2dhUzrbc*yVuM zcKMZqLYlmRI@fX!9_BfbEZ1NG&r4*vf*V|%ty%xHslm+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PI;FCiob+ zQ3sClPB&BN;`kjJNsJY1Qo?Bsq6D(O3&Z?#~-U$sQ@cmMzZ diff --git a/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/x86/libjlinenative.so index 4dba96cd9c45c7299404c3cba51d3913357d82bf..ff8aef34dfb249d920dea6202b254a10b6ba3d7c 100755 GIT binary patch delta 848 zcmZ8fZAepL6h7~rTdrKXl?AKZRc}en+?r!LTq`^(uBNbU047J3!xUXwvPeyg$CM;J`vzAJOJQ9J*&s#X90P@2y zJLLM#vgURfK)EiY8t$i*Fd>&=sqwP;(7>mPxnaubnKtJDlppAgN`p0t!HZc~Wh`a; zFk-Yy5xTv1GG%b*$DsV9y7oxT#Gpr-06LpE_wbjh_DpnbRpyO;!;qL|ZK*q1XYnou(k4m=E;etEwI(o+Lg+Jo8Oe z&lA5Qju0Q8SJheKWkPyTc-!Hes!!)x@7gd?i5+73Zmr zwAw}1!WsJPrWSaYWHt2v>4B$-gpnos-V*(SbkYB(0w5^f+$x6Ool??blax_sKf_I~ zLY9rP%cAGAas)6)iciWhh2t)ZHcC+x-?(lHMFMu`rRf5uSnoITwy+kQ$+PJHy?6Xc iYK$7?c&BX0Z)D7l=iHgPrd;w>z`O1Y)`c(KYkvbR8`7fy delta 714 zcmZ8fO=uHg5S`gg!me&1o2)1mo86{bi;%=5O%trR2lXJK9%`j(5d?ogL@N>WAY#!T zL<)^lQ6xx25tMpy^{mp1?LiPc6r|Qe3po`0Ii(=3Gl>!Dz~g&|Ue9ja;?(GQ1a+yFmNRd)Dp#t{K)0-dNFU zgTH-$Y$lrUCL$#fR_@r{8Nkizt`tkeuKvyUi_F@0-ydZ*fB61Q=8eqvnO`%%2YPCE z;uD&+;~OTqLF0l%m~n_PPUuAOGVODAXwtOIW}c%i8lJ13LUNOqvSiZXWTMC5wL+|@ z@LKDbrx@!Q;-oUb8c*9S8ja$J*S0f> z7@*zhn6hBf@$~tKJbg0^NU*uIraJ}-JW_5I0Ud_^&J>x=IJqXjwkChT`5x|n$Xee zaES*AEE>y2=~thH-DKut`oCYQ@x7Qg^bs3CFzublpFy-~wh#{uX8;zEeik}6_4WeH Kv12P*gZ}_oAeM0e diff --git a/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so b/native/src/main/resources/org/jline/nativ/Linux/x86_64/libjlinenative.so index 826ebf071df8032c4f70ce13764d6eccf44c7a9a..918a45b3b94eff499d25915ee00f261f86c5f655 100755 GIT binary patch delta 1710 zcmZuyT}&KR6ux(c{h8%wca~j;?b0sgr!jV2y}vf{Hd#9-!lypBoAFY-YZ5 z&OLu~?zwl@kIdIi_ilaMjFxJUOne$&y1(}2&sQ#TjsK%LWStn`qD9x;FqZy-KRF*wfXGXpVxv&zHEj5#p@Em^ z131AifIk2SM8iF?w#Z-@ycxk)C{cf_Xznn4hj&G=2OP0tIVzRq6llmYOsk)S zRI@|h4L38cx7XSVi2U|Kj8oF`=r`6yqEvODN+~&xZ@aG^xeDZZC-fkM$m6v^)o0wK zLZ@81A;*7_M>ldt-13-dRe)(zkyX$vsyO)GRKVR7;5Spr$uEQgLWZB0M{D0vxlVM8 zWyxc;AEET9R#B8kGQPU*nkG;|pDe1$d;NCbTUusJ`=JHXj@FUk%*UtEve)iw!g9t; zrOxugAItGOt?^Y{X;3EWc|uOM#vi`c)o`kz zYmpE*XeqnY7a9o#`a|d52((29dcs3Pjl+@tGvR3Q_Kggl9qcEqnrUPp@N%R-+!P+_ ziADxv1JT2TP%nR29aweT^R^VF4RJr>1;m=CilT1C5yTn96~u>#D!H(RG0SdlVG};J z?5mjBR1~Ye!j{P?)t zS_7XrBoFg9%r)S#MN_ckkkDbt;pQ!58K@}X5i1wnyg-tO5?#=wOp=C>D7EZ7cxoV? zWRn-Rx5`MulN`cs5<{f{PwXUZP2CaqP@0CHoRY`EKFcukBXW2Jbc2}NOsC;Q?(1Aq zfLpmET*3+!uGrCMuZOePQ75)>XN5zW9_u%9uvBltd6(oF$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a$<34UhtS}`)zZFMWoZSjXXp8y8_cI8q zFC; z1gpV3GT9ppR*;Q~q>X}|ESM95O~6315R?Cr5-(HuESU||un^9kvr^*$KMXLwH#bios>#%lV8+lRFu^B{P6ROh7CF z#03rv3@ku;1CZ{Rtji?M$qeLyFymxHX5+~XOdJCD`m^4}O*Y&#=SR))1OIH6^nsHMt}pvmn(o zw;+eX2dp$RU*9b=C)FjjIJqdZpd`P@nql%fdpTZE2$}%h48pFHZ`xZjT25ZzppwO4 z$IQ@C4Gb()T?}!^<})NSGfb%l2HBe$pkkgIpjZHfEX1jG_R zoZ!H~zzn1(0O^Ryx=iAnAQ=#5oNUN!Jh_31LqIJns0|SE+<7PwVaI4J@%<_zrJ8X4W4ze-`OrBtu!nBxq zvYegYWEXq&$?NT9c|l$<0crx_&dE3JEg9V>A8;_X_F-mNQVVq7hFYKm7%Zvf0n;EC z@-s33Jqr=%gYq{(`OcFUIs^%)ROY0_7nhVK#V2LvrKA=C6-_pCbYOG%puohy1N5N5 z>#d8;9HuvfrZF}i K{l>5;HyHpik8sfd diff --git a/native/src/main/resources/org/jline/nativ/Mac/x86/libjlinenative.jnilib b/native/src/main/resources/org/jline/nativ/Mac/x86/libjlinenative.jnilib index 49c97f9cb3055387a6a92b5a8177a0e551f41a6b..e1c953ffa016327d624bf9c49dc69f4943038ff6 100755 GIT binary patch delta 381 zcmccM*yA*zgzE$^14A1l1H%d4iFH<-e*6p!Squyeej5)uGcxfoPG)0D;$#B~L?|#Y zY?)lhB+kkV6q4rwd+zWEN*8?MP4_;?k~m>3v3 zeN=e5JMw3^X%k)mwKGI?HwZILzQ?DoU<0%|F!+CfMDr1W&f|tBTmP5jbu;(& zMFGWorv)=kR^`{=NCb1@7$=AF+f07LC&{>PG8?};&!5#o2Xk^g< delta 249 zcmeBiy5KmWglhvI1H(fG28IoM6YH!vC-O5er~`QuHy(6mWV*mGnT;ullNBi7qrkw> zGP#gRoRta4W1U>cY%qB*6TiSkr7LH@{xdncWkK@^!H+4*o9{5a;hNmQ{9^J6US1wQ zMh1pX9~GYN4mZZh4|#=|v>7LV<5g#x&M;Y?Pi*onJ_E)*lezhICQsrMpX|r4K6wYf z3@^wm4mhnM&SrCe08Q;WLcA^6O5N-fe6vStm?8qcN zIf79^Gyy8R04fXOGlOMUFd8sfFiyV3*d>_(lw<;82_P;IU|?VY(i?zu$K+ZjaZY9+ z4}=*f2QnK^zQDvGuqBS!>-SoVJG1^=h@Iixk~#SWQ-DwgPy+{0nI;eenLvX!2QuH} zoE*fbsu%_I$NvBW&(7nnhEIH3|CiKxbTfPOibev(J$iW~87I%+v*J{Q@MIY$-{!NE z4)y4K>KN`A<{0W25**;!dCjBqH&~bH(a9BjiHyCIZ}BOx`*ePE{6E2AG9$meQ&wVG zqJBN*bt`dk-jfLE+91WWb^v6vrUG r9yAF!L;0_u{Ibc70zs4K38=}Vn4D6XlM-KCQkoQ>l$i(gGXnzvHrJ6& delta 364 zcmdm?^g?k$hfok70~j2KPz*tQ6KB~8N%BLu>QGTh{)w;bL>-`_0Z>s8pJ}oqll0^W zMg`FcP}u^gEQrqxmR-SU!1RJ)@-4mq$4KRGKq77WI&j4 zav-zurFa-!j05xy`m1zPokO?$sb0G62&dmwT zW{i`Sc~u$bO=jgwWJ+Y1yoT3q@-ja4$pZW`d?25i09Avq6#rx^emAB?|0Xx_t1-4t zzR7RN=sx*?fU&g?Gs7hrptJ7E0F{BkB^hoo4RRPiBLgsmAmShj#E*sYohL682og=H V%t?taE-6ilPs+?oNi71a1pvZ1LxBJQ diff --git a/native/src/main/resources/org/jline/nativ/Windows/x86/jlinenative.dll b/native/src/main/resources/org/jline/nativ/Windows/x86/jlinenative.dll index 74829f10aa1bce86458e415063d4b9712a5addd5..10ddc9c4855b721b0384f26ae5b255f18f2161fc 100755 GIT binary patch delta 7157 zcmZu$30zZG)_?brga{ZSvM(X*i-0dNU}U`1BV4Hu$MtfmIDf(?a-kf@rFK4jH+iS?b_(ecKhTq~PC-E$Xb~y& zs|ZH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;l=s#pqxEU@w<7#+z4Wa6MsX=y`MDc`UYhe;^jCq)5?)fVdbvpkUL zgQ^0V2xPei$pw-NiCRF*faGg*s(@IaqptfNAYu>|Iob$l|KM!aY}vG~wgPANAOZvF z1?W7laqR>mKF!s`#?f#t#QgGhS! P8%=aZ?mpQ}+lK!ieY%pq diff --git a/native/src/test/java/org/jline/nativ/JLineLibraryTest.java b/native/src/test/java/org/jline/nativ/JLineLibraryTest.java index 7aab3ae92..9b841bdac 100644 --- a/native/src/test/java/org/jline/nativ/JLineLibraryTest.java +++ b/native/src/test/java/org/jline/nativ/JLineLibraryTest.java @@ -26,4 +26,16 @@ void testNewFileDescriptor() throws Exception { field.setAccessible(true); assertEquals(12, field.get(fd), fd.toString()); } + + @Test + void testNewRedirectPipeImpl() throws Exception { + ProcessBuilder.Redirect redirect = JLineLibrary.newRedirectPipe(FileDescriptor.out); + assertNotNull(redirect); + // This requires '--add-opens java.base/java.lang=ALL-UNNAMED', but adding this option + // defeats the very purpose of the method + // + // Method mth = redirect.getClass().getDeclaredMethod("getFd"); + // mth.setAccessible(true); + // assertEquals(System.out, mth.invoke(redirect), redirect.toString()); + } } diff --git a/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java index dc57b1802..8797f7845 100644 --- a/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java +++ b/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java @@ -79,6 +79,15 @@ public final class TerminalBuilder { public static final String PROP_FILE_DESCRIPTOR_CREATION_MODE_REFLECTION = "reflection"; public static final String PROP_FILE_DESCRIPTOR_CREATION_MODE_DEFAULT = "reflection,native"; + // + // System properties controlling how RedirectPipe are created. + // The value can be a comma separated list of defined mechanisms. + // + public static final String PROP_REDIRECT_PIPE_CREATION_MODE = "org.jline.terminal.exec.redirectPipeCreationMode"; + public static final String PROP_REDIRECT_PIPE_CREATION_MODE_NATIVE = "native"; + public static final String PROP_REDIRECT_PIPE_CREATION_MODE_REFLECTION = "reflection"; + public static final String PROP_REDIRECT_PIPE_CREATION_MODE_DEFAULT = "reflection,native"; + // // Terminal output control // diff --git a/terminal/src/main/java/org/jline/terminal/impl/exec/ExecTerminalProvider.java b/terminal/src/main/java/org/jline/terminal/impl/exec/ExecTerminalProvider.java index ed6c9e646..61b19cc77 100644 --- a/terminal/src/main/java/org/jline/terminal/impl/exec/ExecTerminalProvider.java +++ b/terminal/src/main/java/org/jline/terminal/impl/exec/ExecTerminalProvider.java @@ -16,6 +16,8 @@ import java.lang.reflect.Field; import java.nio.charset.Charset; +import org.jline.nativ.JLineLibrary; +import org.jline.nativ.JLineNativeLoader; import org.jline.terminal.Attributes; import org.jline.terminal.Size; import org.jline.terminal.Terminal; @@ -28,6 +30,11 @@ import org.jline.utils.Log; import org.jline.utils.OSUtils; +import static org.jline.terminal.TerminalBuilder.PROP_REDIRECT_PIPE_CREATION_MODE; +import static org.jline.terminal.TerminalBuilder.PROP_REDIRECT_PIPE_CREATION_MODE_DEFAULT; +import static org.jline.terminal.TerminalBuilder.PROP_REDIRECT_PIPE_CREATION_MODE_NATIVE; +import static org.jline.terminal.TerminalBuilder.PROP_REDIRECT_PIPE_CREATION_MODE_REFLECTION; + public class ExecTerminalProvider implements TerminalProvider { private static boolean warned; @@ -137,7 +144,7 @@ public String systemStreamName(Stream stream) { try { ProcessBuilder.Redirect input = stream == Stream.Input ? ProcessBuilder.Redirect.INHERIT - : getRedirect(stream == Stream.Output ? FileDescriptor.out : FileDescriptor.err); + : newDescriptor(stream == Stream.Output ? FileDescriptor.out : FileDescriptor.err); Process p = new ProcessBuilder(OSUtils.TTY_COMMAND).redirectInput(input).start(); String result = ExecHelper.waitAndCapture(p); @@ -157,20 +164,82 @@ public String systemStreamName(Stream stream) { return null; } + private static RedirectPipeCreator redirectPipeCreator; + + protected static ProcessBuilder.Redirect newDescriptor(FileDescriptor fd) { + if (redirectPipeCreator == null) { + String str = System.getProperty(PROP_REDIRECT_PIPE_CREATION_MODE, PROP_REDIRECT_PIPE_CREATION_MODE_DEFAULT); + String[] modes = str.split(","); + IllegalStateException ise = new IllegalStateException("Unable to create RedirectPipe"); + for (String mode : modes) { + try { + switch (mode) { + case PROP_REDIRECT_PIPE_CREATION_MODE_NATIVE: + redirectPipeCreator = new NativeRedirectPipeCreator(); + break; + case PROP_REDIRECT_PIPE_CREATION_MODE_REFLECTION: + redirectPipeCreator = new ReflectionRedirectPipeCreator(); + break; + } + } catch (Throwable t) { + // ignore + ise.addSuppressed(t); + } + if (redirectPipeCreator != null) { + break; + } + } + if (redirectPipeCreator == null) { + throw ise; + } + } + return redirectPipeCreator.newRedirectPipe(fd); + } + + interface RedirectPipeCreator { + ProcessBuilder.Redirect newRedirectPipe(FileDescriptor fd); + } + /** - * This requires --add-opens java.base/java.lang=ALL-UNNAMED + * Reflection based file descriptor creator. + * This requires the following option + * --add-opens java.base/java.lang=ALL-UNNAMED */ - private ProcessBuilder.Redirect getRedirect(FileDescriptor fd) throws ReflectiveOperationException { - // This is not really allowed, but this is the only way to redirect the output or error stream - // to the input. This is definitely not something you'd usually want to do, but in the case of - // the `tty` utility, it provides a way to get - Class rpi = Class.forName("java.lang.ProcessBuilder$RedirectPipeImpl"); - Constructor cns = rpi.getDeclaredConstructor(); - cns.setAccessible(true); - ProcessBuilder.Redirect input = (ProcessBuilder.Redirect) cns.newInstance(); - Field f = rpi.getDeclaredField("fd"); - f.setAccessible(true); - f.set(input, fd); - return input; + static class ReflectionRedirectPipeCreator implements RedirectPipeCreator { + private final Constructor constructor; + private final Field fdField; + + @SuppressWarnings("unchecked") + ReflectionRedirectPipeCreator() throws Exception { + Class rpi = Class.forName("java.lang.ProcessBuilder$RedirectPipeImpl"); + constructor = (Constructor) rpi.getDeclaredConstructor(); + constructor.setAccessible(true); + fdField = rpi.getDeclaredField("fd"); + fdField.setAccessible(true); + } + + @Override + public ProcessBuilder.Redirect newRedirectPipe(FileDescriptor fd) { + try { + ProcessBuilder.Redirect input = constructor.newInstance(); + fdField.set(input, fd); + return input; + } catch (ReflectiveOperationException e) { + // This should not happen as the field has been set accessible + throw new IllegalStateException(e); + } + } + } + + static class NativeRedirectPipeCreator implements RedirectPipeCreator { + public NativeRedirectPipeCreator() { + // Force load the library + JLineNativeLoader.initialize(); + } + + @Override + public ProcessBuilder.Redirect newRedirectPipe(FileDescriptor fd) { + return JLineLibrary.newRedirectPipe(fd); + } } }