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
The blank in option "-x directory" should be deleted from perlrun.pod #8988
Comments
From yuzg@cn.fujitsu.comHello Mr. Larry Wall, I find a bug in perlrun.pod(stable release perl-5.8.8 and Development Use option '-x' can tell Perl that the program is embedded in a larger This problem can reproduce by the following code: The method to confirm this bug is as follows: 1) use '-x directory': 2) use '-xdirectory': I have made two patchs for perlrun.pod in stable release perl-5.8.8 and Thanks a lot. Regards Fixing this description error in perlrun.pod: 1) The patch for stable release perl-5.8.8 Inline Patch--- perl-5.8.8/pod/perlrun.pod.orig 2007-08-04 00:53:28.000000000 +0800
+++ perl-5.8.8/pod/perlrun.pod 2007-08-04 00:54:40.000000000 +0800
@@ -949,7 +949,7 @@
=item B<-x>
X<-x>
-=item B<-x> I<directory>
+=item B<-x>I<directory>
tells Perl that the program is embedded in a larger chunk of unrelated
ASCII text, such as in a mail message. Leading garbage will be
-------------------------------------------------------------------------------
2) The patch for Development Release perl-5.9.3
-------------------------------------------------------------------------------
--- perl-5.9.3/pod/perlrun.pod.orig 2007-08-04 00:28:20.000000000 +0800
+++ perl-5.9.3/pod/perlrun.pod 2007-08-04 00:35:20.000000000 +0800
@@ -972,7 +972,7 @@
=item B<-x>
X<-x>
-=item B<-x> I<directory>
+=item B<-x>I<directory>
tells Perl that the program is embedded in a larger chunk of unrelated
ASCII text, such as in a mail message. Leading garbage will be
------------------------------------------------------------------------------- |
From yuzg@cn.fujitsu.comperlrun.pod.5.8.8.patch--- perl-5.8.8/pod/perlrun.pod.orig 2007-08-04 00:53:28.000000000 +0800
+++ perl-5.8.8/pod/perlrun.pod 2007-08-04 00:54:40.000000000 +0800
@@ -949,7 +949,7 @@
=item B<-x>
X<-x>
-=item B<-x> I<directory>
+=item B<-x>I<directory>
tells Perl that the program is embedded in a larger chunk of unrelated
ASCII text, such as in a mail message. Leading garbage will be
|
From yuzg@cn.fujitsu.comperlrun.pod.5.9.3.patch--- perl-5.9.3/pod/perlrun.pod.orig 2007-08-04 00:28:20.000000000 +0800
+++ perl-5.9.3/pod/perlrun.pod 2007-08-04 00:35:20.000000000 +0800
@@ -972,7 +972,7 @@
=item B<-x>
X<-x>
-=item B<-x> I<directory>
+=item B<-x>I<directory>
tells Perl that the program is embedded in a larger chunk of unrelated
ASCII text, such as in a mail message. Leading garbage will be
|
From steven@accognoscere.orgConfirmed (as of #31680). Albeit nicely spotted, it is recommended practice to create diffs I'm of the opinion that removing the separating space between "-x Perhaps it'd be more sensible to wrap "-xdirectory" in something like |
The RT System itself - Status changed from 'new' to 'open' |
From guest@guest.guest.xxxxxxxxHello, Thanks for your reply. I agree after consulting the output of "perl --help", users can get But I think we should not use wrapping format in perlrun.pod, because: 1) using commands "man perlrun.man"(*.man comes from *.pod) 2) in the description of "-x" is contains: 3) the output format is the same with option "-d": So, I think there will be no confusion, and we don't need to use the If use wrapping format, I think we'd better use "-x[directory]" rather than "-x<directory>", -x[directory] -------> the is a underline on word "directory" because it is compatible with option "-0[octal/hexadecimal]" -0[octal/hexadecimal] -> the is a underline on octal/hexadecimal In conclusion, I think we'd better use the format: Thanks. |
From @davidnicol
Or fix the argument parsing so that perl matches the current documentation? -- |
From jns@gellyfish.comOn Mon, 2007-08-06 at 13:09 -0500, David Nicol wrote:
It would seem that most of the options allow having either space or no /J\ |
From @jdheddenThe attached patch allows both '-xdirectory' and '-x directory' to |
From @jdheddenminus_x.patch--- perl-current/perl.c
+++ perl-current/perl.c
@@ -1997,8 +1997,12 @@
case 'x':
PL_doextract = TRUE;
s++;
- if (*s)
+ if (*s) {
cddir = s;
+ } else if ((s = argv[1]) && (*s != '-')) {
+ argc--,argv++;
+ chdir = s;
+ }
break;
case 0:
break;
|
From @ysthOn Wed, August 8, 2007 11:47 am, Abhijit Menon-Sen wrote:
This seems a dangerous change; how do you indicate that you don't want -x to $ cat foo $ perl -x foo bar $ perl5.9.5 -x foo bar This seems to trip up the switch tests, too. |
From ams@toroid.orgAt 2007-08-06 14:47:57 -0400, jdhedden@cpan.org wrote:
Actually, it would cause a compile error because the variable is named -- ams Change 31690 by ams@penne on 2007/08/08 18:45:34 Make '-xx' and '-x x' work the same way (see #44387). Affected files ... ... //depot/perl/perl.c#817 edit Differences ... ==== //depot/perl/perl.c#817 (text) ==== @@ -1997,8 +1997,13 @@ |
From @jdhedden
Just noticed this myself. I'm working on a follow-on patch complete with tests. |
From @jdhedden
(Sorry, forgot to answer your question.) The patch I'm planning tests that the next arg is a directory. --- perl-current/perl.c Is this okay? |
From @ysthOn Wed, August 8, 2007 1:28 pm, Jerry D. Hedden wrote:
Not sure. To chdir, you only need execute access, not read access (which the |
From @jdhedden
Argh. Would someone please help me with what the equivalent |
From @jdheddenMy previous patch (which became change 31690) broke '-x'. Attached patch fixes this, and adds tests for '-x', '-x dir' and '-xdir'. (I actually compiled and tested it this time.) |
From @jdheddenswitch_x.patchdiff -urN perl-current/MANIFEST perl-current/MANIFEST
--- perl-current/MANIFEST
+++ perl-current/MANIFEST
@@ -3876,6 +3876,7 @@
t/run/switchPx.t Test the -Px combination
t/run/switcht.t Test the -t switch
t/run/switchx.aux Data for switchx.t
+t/run/switchx.aux2 Data for switchx.t
t/run/switchx.t Test the -x switch
t/TEST The regression tester
t/TestInit.pm Preamble library for core tests
diff -urN perl-current/perl.c perl-current/perl.c
--- perl-current/perl.c
+++ perl-current/perl.c
@@ -2000,9 +2000,14 @@
if (*s) {
cddir = s;
}
+ /* If following arg is a dir, then use it */
else if ((s=argv[1]) && *s != '-') {
- argc--,argv++;
- cddir = s;
+ DIR *dir;
+ if ((dir = PerlDir_open(s))) {
+ PerlDir_close(dir);
+ argc--,argv++;
+ cddir = s;
+ }
}
break;
case 0:
diff -urN perl-current/t/run/switchx.aux perl-current/t/run/switchx.aux
--- perl-current/t/run/switchx.aux
+++ perl-current/t/run/switchx.aux
@@ -17,5 +17,13 @@
#!/some/path/that/leads/to/perl -l
-print "1..1";
-print "ok 1";
+print "1..6";
+if (-f 'run/switchx.aux') {
+ print "ok 1";
+}
+print "ok 2";
+
+__END__
+
+# This is ignored
+print "not ok 2";
diff -urN perl-current/t/run/switchx.aux2 perl-current/t/run/switchx.aux2
--- perl-current/t/run/switchx.aux2
+++ perl-current/t/run/switchx.aux2
@@ -0,0 +1,32 @@
+From: foo@bar.xx
+Date: Jan 1, 2037 12:34 PM
+Subject: Ignore mail header
+To: perl@perl.xx
+
+#perl
+Not perl
+
+#!
+Still not perl
+
+#!/something/else
+Still not perl
+
+#!/usr/bin/bash
+# Ingore shell commands
+if [[ -z $FOO ]]; then echo 'not ok 1'; fi
+
+#!/some/path/that/leads/to/perl -l
+
+# These perl command get executed
+my $test = $ARGV[0];
+if (-f 'switchx.t') {
+ print("ok $test");
+}
+$test++;
+print "ok $test";
+
+__END__
+
+# This is ignored
+print "not ok $test";
diff -urN perl-current/t/run/switchx.t perl-current/t/run/switchx.t
--- perl-current/t/run/switchx.t
+++ perl-current/t/run/switchx.t
@@ -8,4 +8,18 @@
require './test.pl';
use File::Spec::Functions;
-print runperl( switches => ['-x'], progfile => catfile(curdir(), 'run', 'switchx.aux') );
+# Test '-x'
+print runperl( switches => ['-x'],
+ progfile => catfile(curdir(), 'run', 'switchx.aux') );
+
+# Test '-x dir'
+print runperl( switches => ['-x', catfile(curdir(), 'run')],
+ progfile => catfile(curdir(), 'run', 'switchx.aux2'),
+ args => [ 3 ] );
+
+# Test '-xdir'
+print runperl( switches => ['-x' . catfile(curdir(), 'run')],
+ progfile => catfile(curdir(), 'run', 'switchx.aux2'),
+ args => [ 5 ] );
+
+# EOF
|
From @davidnicolInline Patch--- CURRENT/pod/perlrun.pod 2007-01-24 05:24:57.000000000 -0600
+++ CURRENT_modified/pod/perlrun.pod 2007-08-08 18:04:54.000000000 -0500
@@ -981,7 +981,7 @@
=item B<-x>
X<-x>
-=item B<-x> I<directory>
+=item B<-x>I<directory>
tells Perl that the program is embedded in a larger chunk of unrelated
ASCII text, such as in a mail message. Leading garbage will be
@@ -994,6 +994,9 @@
can process any or all of the trailing garbage via the DATA filehandle
if desired).
+The directory, if specified, must appear immedately following the B<-x>
+with no intervening whitespace.
+
=back
=head1 ENVIRONMENT |
From @jdhedden'-x' and '-xdir' work as before. For '-x dir', it checks if the The patch includes tests for all this. |
From @jdheddenswitch_x.patchdiff -urN perl-current/MANIFEST perl-patched/MANIFEST
--- perl-current/MANIFEST 2007-08-08 15:39:37.000000000 -0400
+++ perl-patched/MANIFEST 2007-08-08 15:40:14.000000000 -0400
@@ -3876,6 +3876,7 @@
t/run/switchPx.t Test the -Px combination
t/run/switcht.t Test the -t switch
t/run/switchx.aux Data for switchx.t
+t/run/switchx.aux2 Data for switchx.t
t/run/switchx.t Test the -x switch
t/TEST The regression tester
t/TestInit.pm Preamble library for core tests
diff -urN perl-current/perl.c perl-patched/perl.c
--- perl-current/perl.c 2007-08-08 19:00:39.872250000 -0400
+++ perl-patched/perl.c 2007-08-08 19:13:38.524500000 -0400
@@ -1997,8 +1997,19 @@
case 'x':
PL_doextract = TRUE;
s++;
- if (*s)
+ if (*s) {
cddir = s;
+ }
+ /* If following arg is a dir, then use it */
+ else if ((s=argv[1]) && *s != '-') {
+ Stat_t tmpstatbuf;
+ if (PerlLIO_stat(s, &tmpstatbuf) >= 0 &&
+ S_ISDIR(tmpstatbuf.st_mode))
+ {
+ argc--,argv++;
+ cddir = s;
+ }
+ }
break;
case 0:
break;
diff -urN perl-current/t/run/switchx.aux perl-patched/t/run/switchx.aux
--- perl-current/t/run/switchx.aux 2007-08-08 15:40:49.000000000 -0400
+++ perl-patched/t/run/switchx.aux 2007-08-08 19:30:37.517750000 -0400
@@ -17,5 +17,13 @@
#!/some/path/that/leads/to/perl -l
-print "1..1";
-print "ok 1";
+print "1..6";
+if (-f 'run/switchx.aux') {
+ print "ok 1";
+}
+print "ok 2";
+
+__END__
+
+# This is ignored
+print "not ok 2";
diff -urN perl-current/t/run/switchx.aux2 perl-patched/t/run/switchx.aux2
--- perl-current/t/run/switchx.aux2 1969-12-31 19:00:00.000000000 -0500
+++ perl-patched/t/run/switchx.aux2 2007-08-08 16:07:58.000000000 -0400
@@ -0,0 +1,32 @@
+From: foo@bar.xx
+Date: Jan 1, 2037 12:34 PM
+Subject: Ignore mail header
+To: perl@perl.xx
+
+#perl
+Not perl
+
+#!
+Still not perl
+
+#!/something/else
+Still not perl
+
+#!/usr/bin/bash
+# Ingore shell commands
+if [[ -z $FOO ]]; then echo 'not ok 1'; fi
+
+#!/some/path/that/leads/to/perl -l
+
+# These perl command get executed
+my $test = $ARGV[0];
+if (-f 'switchx.t') {
+ print("ok $test");
+}
+$test++;
+print "ok $test";
+
+__END__
+
+# This is ignored
+print "not ok $test";
diff -urN perl-current/t/run/switchx.t perl-patched/t/run/switchx.t
--- perl-current/t/run/switchx.t 2007-08-08 15:40:49.000000000 -0400
+++ perl-patched/t/run/switchx.t 2007-08-08 19:30:49.408375000 -0400
@@ -8,4 +8,18 @@
require './test.pl';
use File::Spec::Functions;
-print runperl( switches => ['-x'], progfile => catfile(curdir(), 'run', 'switchx.aux') );
+# Test '-x'
+print runperl( switches => ['-x'],
+ progfile => catfile(curdir(), 'run', 'switchx.aux') );
+
+# Test '-x dir'
+print runperl( switches => ['-x', catfile(curdir(), 'run')],
+ progfile => catfile(curdir(), 'run', 'switchx.aux2'),
+ args => [ 3 ] );
+
+# Test '-xdir'
+print runperl( switches => ['-x' . catfile(curdir(), 'run')],
+ progfile => catfile(curdir(), 'run', 'switchx.aux2'),
+ args => [ 5 ] );
+
+# EOF
|
From @jdheddenOn 8/8/07, David Nicol <davidnicol@gmail.com> wrote:
Wait a sec. Let's not all give up on this. I am testing a patch |
From ams@toroid.orgAt 2007-08-08 12:57:01 -0700, sthoenna@efn.org wrote:
Yeah. And it doesn't seem worthwhile to check if the next argument -- ams |
From jjuran@gmail.comOn Aug 8, 2007, at 2:02 PM, Jerry D. Hedden wrote:
In straight POSIX/C++ it's struct stat stat_buf; Josh |
From @jdhedden
I don't see how it would break existing scripts. Can you |
From @janduboisOn Wed, 08 Aug 2007, Jerry D. Hedden wrote:
Sure: perl -S -x foo This will search the PATH for "foo" (and "foo.bat" and "foo.cmd" If you now happen to have a directory called "foo" in the current Cheers, |
From @jdheddenOn 8/8/07, Jan Dubois <jand@activestate.com> wrote:
Okay. Punt. |
From ams@toroid.orgAt 2007-08-08 18:06:16 -0500, davidnicol@gmail.com wrote:
Thanks, applied. (#31692) -- ams |
p5p@spam.wizbit.be - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#44387 (status was 'resolved')
Searchable as RT44387$
The text was updated successfully, but these errors were encountered: