Giter Club home page Giter Club logo

Comments (9)

tonycoz avatar tonycoz commented on August 28, 2024 1

Windows searches the current directory first by default anyway:

# argv.exe just dumps argv
C:\Users\Tony\dev\perl\git>copy argv.exe jar.exe
        1 file(s) copied.

C:\Users\Tony\dev\perl\git>jar
0: 'jar'

C:\Users\Tony\dev\perl\git>del jar.exe

C:\Users\Tony\dev\perl\git>jar
Usage: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...
Try `jar --help' for more information.

jar.exe is in the first directory in PATH

So I don't think it matters on Win32.

from perl5.

aarondill avatar aarondill commented on August 28, 2024

This bug is in ..../File/Spec/Unix.pm

my @path = split(':', $ENV{PATH});

Here, split should be passed a negative value for LIMIT: If LIMIT is negative, it is treated as if it were instead arbitrarily large; as many fields as possible are produced.

According to the POSIX Specifications for PATH, trailing colons are counted as empty elements: A zero-length prefix is a legacy feature that indicates the current working directory. It appears as two adjacent <colon> characters ( "::" ), as an initial <colon> preceding the rest of the list, or as a trailing <colon> following the rest of the list

from perl5.

aarondill avatar aarondill commented on August 28, 2024

I am willing to create a PR to fix this, however I'm not sure which other platforms this bug affects.
OS2.pm, Win32.pm, and Unix.pm all use split() to split the $PATH variable and as such are likely susceptible to this bug.

I'm not sure the conventions on Windows or OS2, so I am going to wait until I recieve feedback to start a PR.

from perl5.

jkeenan avatar jkeenan commented on August 28, 2024

I am willing to create a PR to fix this, however I'm not sure which other platforms this bug affects. OS2.pm, Win32.pm, and Unix.pm all use split() to split the $PATH variable and as such are likely susceptible to this bug.

I'm not sure the conventions on Windows or OS2, so I am going to wait until I recieve feedback to start a PR.

Based on @tonycoz's feedback, I recommend creating a pull request consisting of 2 commits.

The first commit should adjust that split line in lib/File/Spec/Unix.pm as you suggest. It should add tests, probably to dist/PathTools/t/Spec.t that would fail if run today but will pass after your code changes. This first commit should also increment $VERSION in all .pm files in the dist/PathTools/ tree in the core distribution (including Cwd.pm). Please make sure that all the tests in dist/PathTools/t/*.t PASS, and please make sure that make test_porting also PASSes.

The second commit should adjust the split line in lib/File/Spec/OS2.pm. I'm suggesting that you do that in a second commit because we probably don't have an OS2 available for testing and if we need to back that change out in the future, it will be easier to have it in a commit of its own.

from perl5.

jkeenan avatar jkeenan commented on August 28, 2024

Also, in the first of the two commits, please run perl Porting/updateAUTHORS.pl to add your name and preferred email address.

from perl5.

aarondill avatar aarondill commented on August 28, 2024

@jkeenan Should the second commit (changing OS2.pm) also increment $VERSION? Or should $VERSION only be incremented once?

from perl5.

jkeenan avatar jkeenan commented on August 28, 2024

@jkeenan Should the second commit (changing OS2.pm) also increment $VERSION? Or should $VERSION only be incremented once?

$VERSION should only be incremented once, and it should be the same in all *.pm files in the distribution.

from perl5.

aarondill avatar aarondill commented on August 28, 2024

Okay, I'll update them to match. Out of curiosity, why don't the $VERSION values match in bleed?

> git sw -q blead && grep -r 'our \$VERSION =' dist/PathTools/
dist/PathTools/Cwd.pm:our $VERSION = '3.90';
dist/PathTools/lib/File/Spec.pm:our $VERSION = '3.90';
dist/PathTools/lib/File/Spec/Cygwin.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Epoc.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/VMS.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Functions.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/AmigaOS.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Win32.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Mac.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/OS2.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Unix.pm:our $VERSION = '3.91';

from perl5.

jkeenan avatar jkeenan commented on August 28, 2024

Okay, I'll update them to match. Out of curiosity, why don't the $VERSION values match in bleed?

> git sw -q blead && grep -r 'our \$VERSION =' dist/PathTools/
dist/PathTools/Cwd.pm:our $VERSION = '3.90';
dist/PathTools/lib/File/Spec.pm:our $VERSION = '3.90';
dist/PathTools/lib/File/Spec/Cygwin.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Epoc.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/VMS.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Functions.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/AmigaOS.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Win32.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Mac.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/OS2.pm:our $VERSION = '3.91';
dist/PathTools/lib/File/Spec/Unix.pm:our $VERSION = '3.91';

Error on our part. I have submitted #22404 to correct. Thanks for spotting that.

from perl5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.