What is an Ignore list?
[Patch Perl@13023] VMS system() warning
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Ñîîáùåñòâà
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Perl web-programming > [Patch Perl@13023] VMS system() warning 19 November 2001 16:00:59

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Ìîäåðàòîð:

[Patch Perl@13023] VMS system() warning

Charles Lane 16 November 2001 23:20:11
 This patch implements the change that Craig Berry suggested earlier this
week, to eliminate duplicate warning messages, and not to throw a warning
as a result of a subprocess error exit.

diff -uBb vms/vms.c-orig vms/vms.c
--- vms/vms.c-origThu Nov 15 22:56:16 2001
+++ vms/vms.cThu Nov 15 22:45:53 2001
@@ -5108,12 +5108,6 @@
if (!cmd || !*cmd) {
hadcmd = 0;
sts = lib$spawn(0,0,0,0,0­,0,&substs,0,0,0,0,0­,0);
- }
- else {
- (void) safe_popen(cmd, "nW", (int *)&sts);
- substs = sts;
- }
-
if (!(sts & 1)) {
switch (sts) {
case RMS$_FNF: case RMS$_DNF:
@@ -5140,8 +5134,13 @@
Strerror(errno));
}
}
+ }
+ else {
+ (void) safe_popen(cmd, "nW", (int *)&sts);
+ }
+
vms_execfree(aTHX);­
- return substs;
+ return sts;

} /* end of do_spawn() */
/*}}}*/
--
Drexel University \V --Chuck Lane
======]---------->-­-------*------------­<-------[===========
(215) 895-1545 _/ \ Particle Physics
FAX: (215) 895-5934 /\ /~~~~~~~~~~~ lane@duphy4.physics.drexel.edu
Add comment
Jarkko Hietaniemi 16 November 2001 23:21:10 permanent link ]
 On Fri, Nov 16, 2001 at 03:20:11PM -0500, Charles Lane wrote:> This patch implements the change that Craig Berry suggested earlier this> week, to eliminate duplicate warning messages, and not to throw a warning> as a result of a subprocess error exit.

Thanks, applied.

--
$jhi++; # http://www.iki.fi/j­hi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
Add comment
Craig A. Berry 17 November 2001 00:51:52 permanent link ]
 At 3:20 PM -0500 11/16/01, Charles Lane wrote:>This patch implements the change that Craig Berry suggested earlier this>week, to eliminate duplicate warning messages, and not to throw a warning>as a result of a subprocess error exit.

But doesn't this change the behavior of the lib$spawn case? We
should return the value of substs (the completion status of the
subprocess), it's just that sts (the status of initiating the
subprocess) should be checked first (with a warning thrown if
necessary). In the safe_popen case, the initiation checking has
already been done internally so we don't want to do it again and we
can't anyway because all we get back from it is the process
completion status. You really don't want to do the checks that were
designed for process initiation on the status you get from process
completion.

I think you want something like this instead:

--- vms.c;-0 Fri Nov 16 15:19:55 2001
+++ vms.c Fri Nov 16 15:47:46 2001
@@ -5110,11 +5110,10 @@
sts = lib$spawn(0,0,0,0,0­,0,&substs,0,0,0,0,0­,0);
}
else {
- (void) safe_popen(cmd, "nW", (int *)&sts);
- substs = sts;
+ (void) safe_popen(cmd, "nW", (int *)&substs);
}

- if (!(sts & 1)) {
+ if (!hadcmd && !(sts & 1)) {
switch (sts) {
case RMS$_FNF: case RMS$_DNF:
set_errno(ENOENT); break;


--
___________________­____________________­_____
Craig A. Berry
mailto:craigberry@m­ac.com

"Literary critics usually know what they're
talking about. Even if they're wrong."
-- Perl creator Larry Wall
Add comment
Charles Lane 17 November 2001 01:05:05 permanent link ]
 Craig Berry writes:> At 3:20 PM -0500 11/16/01, Charles Lane wrote:> >This patch implements the change that Craig Berry suggested earlier this> >week, to eliminate duplicate warning messages, and not to throw a warning> >as a result of a subprocess error exit.
But doesn't this change the behavior of the lib$spawn case? We> should return the value of substs (the completion status of the> subprocess), it's just that sts (the status of initiating the> subprocess) should be checked first (with a warning thrown if> necessary).

Drat.
In the safe_popen case, the initiation checking has> already been done internally so we don't want to do it again and we> can't anyway because all we get back from it is the process> completion status. You really don't want to do the checks that were> designed for process initiation on the status you get from process> completion.
I think you want something like this instead:

(patch elided)
Well, the patch I posted put all the "set errno & throw warning" stuff
only after the lib$spawn, so I think the testing of sts is doing what
you want.

But you're right, the return needs to have substs from lib$spawn, not
sts.

Okay, apply on top of the previous patch:

diff -uBb vms/vms.c-orig vms/vms.c
--- vms/vms.c-origFri Nov 16 17:03:26 2001
+++ vms/vms.cFri Nov 16 17:02:53 2001
@@ -5134,6 +5134,7 @@
Strerror(errno));
}
}
+ sts = substs;
}
else {
(void) safe_popen(cmd, "nW", (int *)&sts);
--
Drexel University \V --Chuck Lane
======]---------->-­-------*------------­<-------[===========
(215) 895-1545 _/ \ Particle Physics
FAX: (215) 895-5934 /\ /~~~~~~~~~~~ lane@duphy4.physics.drexel.edu
Add comment
Craig A. Berry 17 November 2001 01:28:38 permanent link ]
 At 5:05 PM -0500 11/16/01, Charles Lane wrote:
(patch elided)>Well, the patch I posted put all the "set errno & throw warning" stuff>only after the lib$spawn, so I think the testing of sts is doing what>you want.

OK.
But you're right, the return needs to have substs from lib$spawn, not>sts.>
Okay, apply on top of the previous patch:

Looks good to me. This should make it functionally equivalent to my alternative patch.
diff -uBb vms/vms.c-orig vms/vms.c>--- vms/vms.c-origFri Nov 16 17:03:26 2001>+++ vms/vms.cFri Nov 16 17:02:53 2001


--
___________________­____________________­_____
Craig A. Berry
mailto:craigberry@m­ac.com

"Literary critics usually know what they're
talking about. Even if they're wrong."
-- Perl creator Larry Wall
Add comment
Jarkko Hietaniemi 17 November 2001 21:57:53 permanent link ]
 Just checking since the patches I've seen don't quite "add up",
here's vms.c:P­erl_do_spawn­ as of patch 13036:

/* {{{unsigned long int do_spawn(char *cmd) */
unsigned long int
Perl_do_spawn(pTHX_­ char *cmd)
{
unsigned long int sts, substs, hadcmd = 1;

TAINT_ENV();
TAINT_PROPER("spawn­");
if (!cmd || !*cmd) {
hadcmd = 0;
sts = lib$spawn(0,0,0,0,0­,0,&substs,0,0,0,0,0­,0);
if (!(sts & 1)) {
switch (sts) {
case RMS$_FNF: case RMS$_DNF:
set_errno(ENOENT); break;
case RMS$_DIR:
set_errno(ENOTDIR);­ break;
case RMS$_DEV:
set_errno(ENODEV); break;
case RMS$_PRV:
set_errno(EACCES); break;
case RMS$_SYN:
set_errno(EINVAL); break;
case CLI$_BUFOVF: case RMS$_RTB: case CLI$_TKNOVF: case CLI$_RSLOVF:
set_errno(E2BIG); break;
case LIB$_INVARG: case LIB$_INVSTRDES: case SS$_ACCVIO: /* shouldn't happ\
en */
_ckvmssts(sts); /* fall through */
default: /* SS$_DUPLNAM, SS$_CLI, resource exhaustion, etc. */
set_errno(EVMSERR);­
}
set_vaxc_errno(sts)­;
if (ckWARN(WARN_EXEC))­ {
Perl_warner(aTHX_ WARN_EXEC,"Can't spawn \"%s\": %s",
hadcmd ? cmd : "",
Strerror(errno));
}
}
sts = substs;
}
else {
(void) safe_popen(cmd, "nW", (int *)&sts);
}

vms_execfree(aTHX);­
return sts;

} /* end of do_spawn() */
/*}}}*/

--
$jhi++; # http://www.iki.fi/j­hi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
Add comment
Craig A. Berry 17 November 2001 22:31:55 permanent link ]
 At 8:57 PM +0200 11/17/01, Jarkko Hietaniemi wrote:>Just checking since the patches I've seen don't quite "add up",>here's vms.c:P­erl_do_spawn­ as of patch 13036:

This looks right to me (though the indentation is getting a bit
unconventional, Chuck).
--
___________________­____________________­_
Craig A. Berry
mailto:craigberry@m­ac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
Add comment
Jarkko Hietaniemi 18 November 2001 02:17:19 permanent link ]
 On Sat, Nov 17, 2001 at 01:31:55PM -0600, Craig A. Berry wrote:> At 8:57 PM +0200 11/17/01, Jarkko Hietaniemi wrote:> >Just checking since the patches I've seen don't quite "add up",> >here's vms.c:P­erl_do_spawn­ as of patch 13036:>
This looks right to me (though the indentation is getting a bit> unconventional, Chuck).

Any objections if I shake GNU indent at vms/vms.c? (I can iterate
the options a bit till I get somewhat *minimal* set of changes.)

--
$jhi++; # http://www.iki.fi/j­hi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
Add comment
Craig A. Berry 18 November 2001 02:28:12 permanent link ]
 At 1:17 AM +0200 11/18/01, Jarkko Hietaniemi wrote:
Any objections if I shake GNU indent at vms/vms.c? (I can iterate>the options a bit till I get somewhat *minimal* set of changes.)

OK by me.
Add comment
Jarkko Hietaniemi 18 November 2001 02:37:10 permanent link ]
 On Sat, Nov 17, 2001 at 05:28:12PM -0600, Craig A. Berry wrote:> At 1:17 AM +0200 11/18/01, Jarkko Hietaniemi wrote:>
Any objections if I shake GNU indent at vms/vms.c? (I can iterate> >the options a bit till I get somewhat *minimal* set of changes.)>
OK by me.

Rats. I always forget that GNU indent is missing one important
feature: preserving the alignment of variable declarations,

foo_t barbar;
int quux;
char *barfucious;

becomes

foo_t barbar;
int quux;
cha *barfucious;

and preserving the alignment of consecutive assignments

barbar = foo();
quux = 42;
barfucious = "nigglety";

becomes

barbar = foo();
quux = 42;
barfucious = "nigglety";

That messes up code rather badly, so never mind...

--
$jhi++; # http://www.iki.fi/j­hi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
respect your talk pals, avoid using obscene language, typing entire messages in CAPS, posting buy/sell ads or violating netiquette or the RF Criminal Code..


QAIX > Perl web-programming > [Patch Perl@13023] VMS system() warning 19 November 2001 16:00:59

see also:
[SMARTY] Including different…
[SMARTY] register_outputfilter bug ???
[SMARTY] newbie caching question
pass tests:
see also:
Share an easiest way to enjoy all…
How to convert .flv (flash video) to…
HI!

  Copyright © 2001—2009 QAIX
Idea: Miñhael Monashev
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .