perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

Update ReadLine.pm to deal with existence of "con" file or dir in current dir

Open hadjiprocopis opened this issue 3 years ago • 5 comments

The original line: elsif ($^O eq 'MSWin32' or $^O eq 'msys' or -e "con") {

can succeed if a file or dir named "con" exists in current dir and OS is other than MSWin32 or msys. The way the conditional cases are structured, leaves a tiny window for succeeding when OS is VMS or os2, AFAICS.

I am not aware of what "msys" is, so my proposed change may not be entirely correct.

hadjiprocopis avatar Jan 20 '22 18:01 hadjiprocopis

note: Term::ReadLine version need to be bump

atoomic avatar Jan 20 '22 18:01 atoomic

I don't think it makes sense to check for con on known dos-like systems. It should probably just be removed instead of being converted to an and.

haarg avatar Jan 20 '22 22:01 haarg

It is possible to remove con with DefineDosDevice, so while it's pedantry, that check isn't completely unnecessary.

xenu avatar Jan 20 '22 23:01 xenu

msys probably should be removed from that condition, though:

xenu@DESKTOP-6NN6ABR MSYS ~
$ uname -a
MSYS_NT-10.0-19044 DESKTOP-6NN6ABR 3.3.3-341.x86_64 2022-01-18 13:00 UTC x86_64 Msys

xenu@DESKTOP-6NN6ABR MSYS ~
$ perl -E 'say $^O'
msys

xenu@DESKTOP-6NN6ABR MSYS ~
$ ls /dev/tty
/dev/tty

xenu@DESKTOP-6NN6ABR MSYS ~
$ echo foo >con

xenu@DESKTOP-6NN6ABR MSYS ~
$ ls
con

xenu avatar Jan 20 '22 23:01 xenu

I can't understand if anything more from me is needed. let me know.

On 25/01/2022 03:57, ℕicolas ℝ. wrote:

@.**** commented on this pull request.


In dist/Term-ReadLine/lib/Term/ReadLine.pm https://github.com/Perl/perl5/pull/19356#discussion_r791295539:

@@ -242,7 +242,7 @@ sub findConsole {

  if ($^O ne 'MSWin32' and -e $devtty) {
  $console = $devtty;
  • } elsif ($^O eq 'MSWin32' or $^O eq 'msys' or -e "con") {
  • } elsif ( ($^O eq 'MSWin32' or $^O eq 'msys') and -e "con") {

please view recommendations in conversation

— Reply to this email directly, view it on GitHub https://github.com/Perl/perl5/pull/19356#pullrequestreview-861705662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5PLOV2VSVZ2ONY22LR5FTUXX7OZANCNFSM5MNO3JUA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

hadjiprocopis avatar Jan 26 '22 11:01 hadjiprocopis