Closed p5pRT closed 20 years ago
The patch below deals with the following issues:
1. Io/dup test 7 fails. A solution is to fseek the newly opened handle to the current position of the one being dup'ed.
2. "NXIsAlNum" is misspelled in handy.h.
3. Perl.h declares an extern atof(). This fails if atof is a macro. The patch below simply adds "#ifdef atof". An alternative would be to write the declaration as
double (atof) (const char*);
4. A paragraph on FD_CLOEXEC was copied from util.c to pp_sys.c. Perhaps this should be in some common header file. (But keep in mind that that common header file needs to #include \<fcntl.h> for the #ifdef F_SETFD test to work right).
5. -DPERL_EXTMALLOC_DEF was added to hints/next_4.sh\, to fight the PERL_POLLUTE_MALLOC problem.
6. Pragma/warn/pp_hot test 192 fails due to a bug in fread(). NeXT isn't going to fix libc\, so we'll have to skip this test.
The only problem remaining is the noise produced by the op/groups test.
-- HansM
Index: doio.c
*** doio.c.orig Fri Aug 20 17:51:27 1999
--- doio.c Wed Sep 1 22:52:44 1999
***************
*** 86\,91 ****
--- 86\,95 ----
# endif
#endif
+ #if defined(NeXT) || defined(__NeXT__)
+ #define DUP_SHOULD_FSEEK
+ #endif
+
bool
Perl_do_open(pTHX_ GV *gv\, register char *name\, I32 len\, int as_raw\,
int rawmode\, int rawperm\, PerlIO *supplied_fp)
***************
*** 108\,113 ****
--- 112\,120 ----
int fd;
int result;
bool was_fdopen = FALSE;
+ #ifdef DUP_SHOULD_FSEEK
+ Off_t pos;
+ #endif
PL_forkprocess = 1; /* assume true if no fork */
***************
*** 269\,276 ****
else {
/*SUPPRESS 530*/
for (; isSPACE(*name); name++) ;
! if (isDIGIT(*name))
fd = atoi(name);
else {
IO* thatio;
gv = gv_fetchpv(name\,FALSE\,SVt_PVIO);
--- 276\,287 ----
else {
/*SUPPRESS 530*/
for (; isSPACE(*name); name++) ;
! if (isDIGIT(*name)) {
fd = atoi(name);
+ #ifdef DUP_SHOULD_FSEEK
+ pos = PerlLIO_lseek(fd\, 0\, SEEK_CUR);
+ #endif
+ }
else {
IO* thatio;
gv = gv_fetchpv(name\,FALSE\,SVt_PVIO);
***************
*** 294\,299 ****
--- 305\,314 ----
* filehandle? Perhaps we should do
* fsetpos(src)+fgetpos(dst)? --nik */
PerlIO_flush(fp);
+ /* On NeXT we should. --hansm*/
+ #ifdef DUP_SHOULD_FSEEK
+ pos = PerlIO_tell(fp);
+ #endif
fd = PerlIO_fileno(fp);
if (IoTYPE(thatio) == 's')
IoTYPE(io) = 's';
***************
*** 309\,314 ****
--- 324\,336 ----
if (dodup)
PerlLIO_close(fd);
}
+ #ifdef DUP_SHOULD_FSEEK
+ {
+ int save_errno = errno;
+ PerlIO_seek(fp\, pos\, SEEK_SET);
+ errno = save_errno;
+ }
+ #endif
}
}
else {
Index: handy.h
*** handy.h.orig Tue Jul 20 19:17:57 1999
--- handy.h Tue Aug 31 21:28:49 1999
***************
*** 241\,247 ****
#ifdef USE_NEXT_CTYPE
# define isALNUM_LC(c) \
! (NXIsAlnum((unsigned int)(c)) || (char)(c) == '_')
# define isIDFIRST_LC(c) \
(NXIsAlpha((unsigned int)(c)) || (char)(c) == '_')
# define isALPHA_LC(c) NXIsAlpha((unsigned int)(c))
--- 241\,247 ----
#ifdef USE_NEXT_CTYPE
# define isALNUM_LC(c) \
! (NXIsAlNum((unsigned int)(c)) || (char)(c) == '_')
# define isIDFIRST_LC(c) \
(NXIsAlpha((unsigned int)(c)) || (char)(c) == '_')
# define isALPHA_LC(c) NXIsAlpha((unsigned int)(c))
***************
*** 249\,255 ****
# define isDIGIT_LC(c) NXIsDigit((unsigned int)(c))
# define isUPPER_LC(c) NXIsUpper((unsigned int)(c))
# define isLOWER_LC(c) NXIsLower((unsigned int)(c))
! # define isALNUMC_LC(c) NXIsAlnum((unsigned int)(c))
# define isCNTRL_LC(c) NXIsCntrl((unsigned int)(c))
# define isGRAPH_LC(c) NXIsGraph((unsigned int)(c))
# define isPRINT_LC(c) NXIsPrint((unsigned int)(c))
--- 249\,255 ----
# define isDIGIT_LC(c) NXIsDigit((unsigned int)(c))
# define isUPPER_LC(c) NXIsUpper((unsigned int)(c))
# define isLOWER_LC(c) NXIsLower((unsigned int)(c))
! # define isALNUMC_LC(c) NXIsAlNum((unsigned int)(c))
# define isCNTRL_LC(c) NXIsCntrl((unsigned int)(c))
# define isGRAPH_LC(c) NXIsGraph((unsigned int)(c))
# define isPRINT_LC(c) NXIsPrint((unsigned int)(c))
Index: perl.h
*** perl.h.orig Sat Aug 21 00:10:13 1999
--- perl.h Tue Aug 31 23:39:06 1999
***************
*** 2008\,2014 ****
--- 2008\,2016 ----
/* Fix these up for __STDC__ */
#ifndef DONT_DECLARE_STD
char *mktemp (char*);
+ # ifndef atof
double atof (const char*);
+ # endif
#endif
#ifndef STANDARD_C
***************
*** 3112\,3117 ****
--- 3114\,3123 ----
# define Semctl(id\, num\, cmd\, semun) semctl(id\, num\, cmd\, semun.buf)
# endif
# endif
+ #endif
+
+ #if defined(HAS_FCNTL) && defined(F_SETFD) && !defined(FD_CLOEXEC)
+ # define FD_CLOEXEC 1 /* NeXT needs this */
#endif
/* Mention
Index: pp_sys.c
*** pp_sys.c.orig Fri Aug 20 17:52:00 1999
--- pp_sys.c Tue Aug 31 23:39:46 1999
***************
*** 225\,230 ****
--- 225\,234 ----
# define PERL_EFF_ACCESS_X_OK(p) (accessx((p)\, X_OK\, ACC_SELF))
#endif
+ #if defined(HAS_FCNTL) && defined(F_SETFD) && !defined(FD_CLOEXEC)
+ # define FD_CLOEXEC 1 /* NeXT needs this */
+ #endif
+
#if !defined(PERL_EFF_ACCESS_R_OK) && defined(HAS_ACCESS) \
&& (defined(HAS_SETREUID) || defined(HAS_SETRESUID) \
|| defined(HAS_SETREGID) || defined(HAS_SETRESGID))
Index: hints/next_4.sh
*** hints/next_4.sh.orig Mon Jul 26 04:18:06 1999
--- hints/next_4.sh Tue Aug 31 21:07:06 1999
***************
*** 8\,14 ****
ldflags='-dynamic -prebind'
lddlflags='-dynamic -bundle -undefined suppress'
! ccflags='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK'
cccdlflags='none'
ld='cc'
#optimize='-g -O'
--- 8\,14 ----
ldflags='-dynamic -prebind'
lddlflags='-dynamic -bundle -undefined suppress'
! ccflags='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK -DPERL_EXTMALLOC_DEF'
cccdlflags='none'
ld='cc'
#optimize='-g -O'
Index: t/pragma/warn/pp_hot
*** t/pragma/warn/pp_hot.orig Mon Aug 2 18:07:42 1999
--- t/pragma/warn/pp_hot Wed Sep 1 00:40:53 1999
***************
*** 51\,57 ****
open(FOO\, ">&STDOUT") and print \
Site configuration information for perl 5.00561:
Configured by hansm at Tue Aug 31 21:33:53 MET DST 1999.
Summary of my perl5 (revision 5.0 version 5 subversion 61) configuration: Platform: osname=next\, osvers=4_2\, archname=OPENSTEP-Mach uname='bombadil ' config_args='-des -Dcf_email=hansmu@xs4all.nl -Dprefix=/usr/local -Doptimize=-g -O' hint=recommended\, useposix=undef\, d_sigaction=undef usethreads=undef useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='cc'\, optimize='-g -O'\, gccversion=NeXT DevKit-based CPP 4.0 cppflags='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK -DPERL_EXTMALLOC_DEF -arch m68k -DDEBUGGING -I/usr/local/include' ccflags ='-dynamic -fno-common -DUSE_NEXT_CTYPE -DUSE_PERL_SBRK -DPERL_EXTMALLOC_DEF -arch m68k -arch i386 -DDEBUGGING -I/usr/local/include' stdchar='char'\, d_stdstdio=define\, usevfork=false intsize=4\, longsize=4\, ptrsize=4\, doublesize=8 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 alignbytes=8\, usemymalloc=y\, prototype=define Linker and Libraries: ld='cc'\, ldflags ='-dynamic -prebind -arch m68k -arch i386 -L/usr/local/lib' libpth=/lib /usr/lib /usr/local/lib libs= libc=/NextLibrary/Frameworks/System.framework/System\, so=dylib\, useshrplib=true\, libperl=libperl.5.dylib Dynamic Linking: dlsrc=dl_next.xs\, dlext=bundle\, d_dlsymun=undef\, ccdlflags=' ' cccdlflags=' '\, lddlflags='-dynamic -bundle -undefined suppress -arch m68k -arch i386 -L/usr/local/lib'
Locally applied patches:
@INC for perl 5.00561: lib /Users/hansm/lib/perl /usr/local/lib/perl5/5.00561/OPENSTEP-Mach /usr/local/lib/perl5/5.00561 /usr/local/lib/site_perl/5.00561/OPENSTEP-Mach /usr/local/lib/site_perl .
Environment for perl 5.00561: DYLD_LIBRARY_PATH=/Users/hansm/src/perl/build/perl-5.006/perl5.005_61:/Users/hansm/src/perl/build/perl-5.006/perl5.005_60 HOME=/Users/hansm LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/hansm/bin:/usr/local/bin:/usr/games:/usr/ucb:/bin:/usr/bin:/usr/etc:/Users/hansm/bin/cookies:/LocalApps/Opener.app:. PERL5LIB=/Users/hansm/lib/perl PERL_BADLANG (unset) SHELL=/bin/sh
On Thu\, 02 Sep 1999 00:10:03 +0200\, hansm@icgned.icgroup.nl wrote:
1. Io/dup test 7 fails. A solution is to fseek the newly opened handle to the current position of the one being dup'ed.
I think this may be a better general way to avoid lost read buffer contents on all platforms. We need to have a Configure test to see which way works and use it.
3. Perl.h declares an extern atof(). This fails if atof is a macro. The patch below simply adds "#ifdef atof". An alternative would be to write the declaration as
double (atof) (const char*);
Those declarations in perl.h are broken\, in principle. Configure should have figured out which header(s) to include to get all the prototypes for libm.
5. -DPERL_EXTMALLOC_DEF was added to hints/next_4.sh\, to fight the PERL_POLLUTE_MALLOC problem.
PERL_EXTMALLOC_DEF is meant to be used only from extensions\, IIRC. What was the "PERL_POLLUTE_MALLOC problem" again? (Whatever it was\, I think there may be a better fix for it.)
Sarathy gsar@activestate.com
Gurusamy Sarathy writes:
On Thu\, 02 Sep 1999 00:10:03 +0200\, hansm@icgned.icgroup.nl wrote:
1. Io/dup test 7 fails. A solution is to fseek the newly opened handle to the current position of the one being dup'ed.
I think this may be a better general way to avoid lost read buffer contents on all platforms. We need to have a Configure test to see which way works and use it.
Give me a test\, I'll put wrap it into a metaconfig unit.
3. Perl.h declares an extern atof(). This fails if atof is a macro. The patch below simply adds "#ifdef atof". An alternative would be to write the declaration as
double (atof) (const char*);
Those declarations in perl.h are broken\, in principle. Configure should have figured out which header(s) to include to get all the prototypes for libm.
You are piling a lot on Configure\, aren't you? :-)
5. -DPERL_EXTMALLOC_DEF was added to hints/next_4.sh\, to fight the PERL_POLLUTE_MALLOC problem.
PERL_EXTMALLOC_DEF is meant to be used only from extensions\, IIRC. What was the "PERL_POLLUTE_MALLOC problem" again? (Whatever it was\, I think there may be a better fix for it.)
Hmmm\, I just applied a patch from Dominic Dunlop for MachTen that dealt with PERL_POLLUTE_MALLOC\, too (change #4065).
-- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
On Wed\, 1 Sep 1999\, Gurusamy Sarathy wrote:
3. Perl.h declares an extern atof(). This fails if atof is a macro. The patch below simply adds "#ifdef atof". An alternative would
Those declarations in perl.h are broken\, in principle. Configure should have figured out which header(s) to include to get all the prototypes for libm.
True\, in principle. (Of course you can't assume that every desired function even *has* a prototype in a header file. SunOS4 is particularly problematic this way\, since we can't include \<unistd.h> (see hints/sunos_4_1.sh for the painful story). This means you still end up with junk like
#ifndef HAS_ATOF_PROTOTYPE # ifndef atof extern double atof (const char *) ; # endif #endif
Still\, I did write some metaconfig units for just this sort of thing. It's just that in practice\, you're potentially talking about *lots* of Configure tests and implementing them all would certainly be *way* down on any sane person's list of "interesting things to do" :-).
Andy Dougherty doughera@lafayette.edu Dept. of Physics Lafayette College\, Easton PA 18042
On Thu\, 02 Sep 1999 10:21:20 EDT\, Andy Dougherty wrote:
On Wed\, 1 Sep 1999\, Gurusamy Sarathy wrote:
3. Perl.h declares an extern atof(). This fails if atof is a macro. The patch below simply adds "#ifdef atof". An alternative would
Those declarations in perl.h are broken\, in principle. Configure should have figured out which header(s) to include to get all the prototypes for libm.
True\, in principle. (Of course you can't assume that every desired function even *has* a prototype in a header file. SunOS4 is particularly problematic this way\, since we can't include \<unistd.h> (see hints/sunos_4_1.sh for the painful story).
I remember the SunOS case. Even if we don't go the whole hog\, it would be nice to see the prototypes added specifically for those platforms that are known to not have them. Instead\, it's the other way around now\, with people having to hunt around to figure out they need to say DONT_DECLARE_STD (or whatever).
Sarathy gsar@activestate.com
On Thu\, 2 Sep 1999\, Gurusamy Sarathy wrote:
On Thu\, 02 Sep 1999 10:21:20 EDT\, Andy Dougherty wrote:
True\, in principle. (Of course you can't assume that every desired function even *has* a prototype in a header file. SunOS4 is particularly problematic this way\, since we can't include \<unistd.h> (see hints/sunos_4_1.sh for the painful story).
I remember the SunOS case. Even if we don't go the whole hog\, it would be nice to see the prototypes added specifically for those platforms that are known to not have them. Instead\, it's the other way around now\, with people having to hunt around to figure out they need to say DONT_DECLARE_STD (or whatever).
True\, but it's not an easy task. Apart from SunOS\, older systems with missing prototypes are not necessarily well-represented on p5p\, and hence it's hard to figure out what they are missing.
I do agree with your basic sentiment\, but I confess I don't see solving the problem as either particular interesting or particularly urgent at the moment :-(.
Andy Dougherty doughera@lafayette.edu
In article \199909012236\.PAA13560@​activestate\.com\, Gurusamy Sarathy wrote:
What was the "PERL_POLLUTE_MALLOC problem" again?
The problem is that one is not allowed to have a function named "malloc"\, because it clashes with a function by the same name in libc.
Minor problem: the INSTALL file has it backwards. It explains that enabling PERL_POLLUTE_MALLOC may cause linker errors. Since PERL_POLLUTE_MALLOC is now the default\, INSTALL needs to explain how to disable it.
(Whatever it was\, I think there may be a better fix for it.)
In Perl 2.000 through 5.005\, the fix was to add -DHIDEMYMALLOC to ccflags; that would #define malloc Mymalloc\, etc. If the PERL_BINCOMPAT_5005 option in 5.006 is to provide binary compatibility with the default configuration in 5.005\, it must do same on those platforms where HIDEMYMALLOC was the default in 5.005 (i.e.\, on MachTen\, NeXT and QNX).
-- HansM
Migrated from rt.perl.org#1308 (status was 'resolved')
Searchable as RT1308$