develooper Front page | perl.perl5.porters | Postings from February 2000

Patch for RE: [ID 20000202.017] Not OK: perl 5.00564 on MSWin32-x86 4.0 '(U NINSTALLED)'

From:
Konovalov, Vadim
Date:
February 9, 2000 04:38
Subject:
Patch for RE: [ID 20000202.017] Not OK: perl 5.00564 on MSWin32-x86 4.0 '(U NINSTALLED)'
Message ID:
402099F49BEED211999700805FC7359F40AE19@ru0028exch01.spb.lucent.com
Hello.

> From: Gurusamy Sarathy [mailto:gsar@ActiveState.com]
> On Thu, 03 Feb 2000 11:00:46 +0300, "Konovalov, Vadim" wrote:
> >>Finally the `nmake test` results were:
> >>Failed Test  Status Wstat Total Fail  Failed  List of failed
> >>------------------------------------------------------------
> >>io/fs.t                      29    1   3.45%  16
> >
> >My compile (with BC++5.02) was failed at io/fs.t too, but on 
> different test(s). :(
> 
> I think the failures with bcc32 are benign; they looked like they were
> due to the 'other' mode bits that are pretty much meaningless.

I agree.

> Patch to testsuite welcome.

Mine compile failed on tests io/fs.t 5,7,9,10. They all are about stat.
I did some tries on 5.5.650 around this and found some intresting things.

First of all, on 5.005_03 these tests are skipped because $IsDosish is set.
Newer io/fs.t allows additional tests and this introduces failures that 
were not seen in previous versions.

MSVC++ build succeeds on these test while BC++5.2 fails. Why?
In MSVC's distribution in file stat.c there are following lines:

......
        if (p = _tcsrchr(name, _T('.'))) {
            if ( !_tcsicmp(p, _T(".exe")) ||
                 !_tcsicmp(p, _T(".cmd")) ||
                 !_tcsicmp(p, _T(".bat")) ||
                 !_tcsicmp(p, _T(".com")) )
=this_is_my_comment
similar idea iimplemented in (perl-src)/win32/win32.c, in 
#if __BORLANDC__ 
    ..... 
#endif
=cut
                uxmode |= _S_IEXEC;
        }

        /* propagate user read/write/execute bits to group/other fields */

        uxmode |= (uxmode & 0700) >> 3;
        uxmode |= (uxmode & 0700) >> 6;
......

Note what is happened after /* propagete ... */ comments.
Probably MSVC++ does something that is not described in it's manuals and
BC++ does not do, but this probably helps MSVC to be closer to Unix world.

So I propose following patch for 5.5.650.
It touches only BC++ compile and makes resulting Perl to pass all tests:

--- win32.c	Mon Feb 07 14:43:18 2000
+++ d:\WORK\PerlCompile\perl5.5.650\win32\win32.c	Wed Feb 09 12:25:57
2000
@@ -1129,24 +1129,28 @@
 	    }
 	}
 #ifdef __BORLANDC__
 	if (S_ISDIR(sbuf->st_mode))
 	    sbuf->st_mode |= S_IWRITE | S_IEXEC;
 	else if (S_ISREG(sbuf->st_mode)) {
+	    int p;
 	    if (l >= 4 && path[l-4] == '.') {
 		const char *e = path + l - 3;
 		if (strnicmp(e,"exe",3)
 		    && strnicmp(e,"bat",3)
 		    && strnicmp(e,"com",3)
 		    && (IsWin95() || strnicmp(e,"cmd",3)))
 		    sbuf->st_mode &= ~S_IEXEC;
 		else
 		    sbuf->st_mode |= S_IEXEC;
 	    }
 	    else
 		sbuf->st_mode &= ~S_IEXEC;
+	    /* Propagate permissions to _group_ and _others_ */
+	    p = sbuf->st_mode & (S_IREAD|S_IWRITE|S_IEXEC);
+	    sbuf->st_mode |= (p>>3) | (p>>6);
 	}
 #endif
     }
     return res;
 }
End of patch.

Good luck,
Vadim Konovalov.
use strict;%;=qw;. @ @ .;,;$;=q;@;,$,=qq>\n>=>print
unpack q,A28,x6,join q,,,map{;$;=$;{$;};$;x$_;}split q,,,q
<13321523136131112131213171212121312131711524355111113121613132111316431322>



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About