-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On case insensitive file systems using a module with a case inconsistency which is supposed to export a function does not error. #19418
Labels
Comments
demerphq
added a commit
that referenced
this issue
Feb 14, 2022
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a fatal exception is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Feb 14, 2022
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a fatal exception is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Jul 30, 2022
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a fatal exception is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Aug 1, 2022
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Aug 2, 2022
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); # note the typo! will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Feb 20, 2023
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); # note the typo! will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Jul 18, 2023
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); # note the typo! will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Jul 18, 2023
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); # note the typo! will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
demerphq
added a commit
that referenced
this issue
Jul 18, 2023
Since perl 5.0 the methods "import" and "unimport" have been special cased in gv.c (unimport was removed for a while) to not produce errors if they are called. This is partly because use Foo; is defined to be BEGIN { require Foo; Foo->import(); } which would blow up if there is no import function defined in Foo, for instance if it were defining a class and not a package which exports modules. This special case can be broken by simple code like \&UNIVERSAL::isa which will create a stub function which then blows up when it is used. Notably the module "autouse" which is shipped with perl will trigger this behavior. A related issue is that if you ask for a function to be exported from a module that does not have support for exporting there is no error, eg: use File::Spec qw(catfile); will silently succeed without exporting a catfile function. This is exacerbated on case insensitive file systems when the module name is case-mismatched, the use succeeds but the export does not, leading to confusion, eg: use LIst::Util qw(sum); # note the typo! will load List::Util but will not export the sum function. This patch defines UNIVERSAL::import() and UNIVERSAL::unimport() functions. This prevents the "reference to \&UNIVERSAL::import" bug. The function is defined to be a no-op unless arguments are passed into the functions, in which case a warning is thrown indicating that there is likely a problem. The error is modelled after the error produced by calling a non-existent method or function: ./perl -Ilib -le'BEGIN{ my $import_sub= \&UNIVERSAL::import;} use File::Spec qw(catfile);' Attempt to call UNIVERSAL::import() with arguments via package File::Spec (Perhaps you forgot to load "File::Spec"?) at -e line 1. BEGIN failed--compilation aborted at -e line 1. This fixes Issue #19416, Issue #19417, Issue #19418. See also Issue #19410 for discussion, however this patch does not fix that case (it may not be fixable.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
On a case insensitive file system a case mismatch for a use statement that should export will load the module and not throw an error, but it will NOT actually export the function. See also Issue #19417, and Issue #19410
Steps to Reproduce
On a case insensitive file system:
perl -le'use LIST::UTIL qw(sum);'
Expected behavior
Some kind of exception, preferably that the module name is incorrectly spelled, or at least an exception that the function cannot be exported.
Perl configuration
The text was updated successfully, but these errors were encountered: