Skip Menu |

This queue is for tickets about the PerlIO-eol CPAN distribution.

Report information
The Basics
Id: 28104
Status: resolved
Priority: 0/
Queue: PerlIO-eol

People
Owner: Nobody in particular
Requestors: SMPETERS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] quiet warnings on Solaris
--- eol.xs.old Fri Dec 15 22:38:35 2006 +++ eol.xs Wed Jul 11 08:44:04 2007 @@ -12,7 +12,7 @@ PerlIOEOL_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) { PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); - STDCHAR *p, *eol_w = NULL, *eol_r = NULL; + char *p, *eol_w = NULL, *eol_r = NULL; STRLEN len; if (PerlIOBase(PerlIONext(f))->flags & PERLIO_F_UTF8) { @@ -28,7 +28,7 @@ p = SvPV(arg, len); if (len) { - STDCHAR *end = p + len; + char *end = p + len; Newz('e', eol_r, len + 1, char); Copy(p, eol_r, len, char); @@ -154,7 +154,7 @@ if (f) { PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); - s->name = savepv( SvPV_nolen(arg) ); + s->name = (unsigned char *)savepv( SvPV_nolen(arg) ); } return f;
From: GAAL [...] cpan.org
On Wed Jul 11 09:47:35 2007, SMPETERS wrote: Show quoted text
> - STDCHAR *p, *eol_w = NULL, *eol_r = NULL; > + char *p, *eol_w = NULL, *eol_r = NULL;
I'm not sure this is correct. According to config_h.SH in the Perl distro, "This symbol is defined to be the type of char used in stdio.h. It has the values "unsigned char" or 'char'." So I think your perl may be misconfigured?
Subject: [PATCH] quiet (which?) warnings on Solaris
From: MARKSTOS [...] cpan.org
So, what was the warning on Solaris, so we know it if we run into it? Was it this one that I see on FreeBSD? Bad free() ignored (PERL_CORE) That happens when calling "close($fh)" on a lexical file handle that has used this layer. As a workaround, I'm going to try to let the file handle just go out of scope instead. Mark
From: SMPETERS [...] cpan.org
On Wed Oct 31 10:23:54 2007, MARKSTOS wrote: Show quoted text
> So, what was the warning on Solaris, so we know it if we run into it? > > Was it this one that I see on FreeBSD? > > Bad free() ignored (PERL_CORE) > > > That happens when calling "close($fh)" on a lexical file handle that has > used this layer. > > As a workaround, I'm going to try to let the file handle just go out of > scope instead. > > Mark
My warnings are in regards to compiling on Solaris, not running actual code. Steve
On Thu Jul 12 02:41:04 2007, GAAL wrote: Show quoted text
> On Wed Jul 11 09:47:35 2007, SMPETERS wrote:
> > - STDCHAR *p, *eol_w = NULL, *eol_r = NULL; > > + char *p, *eol_w = NULL, *eol_r = NULL;
> > I'm not sure this is correct. According to config_h.SH in the Perl > distro, "This symbol is defined to be the type of char used in stdio.h. > It has the values "unsigned char" or 'char'." > > So I think your perl may be misconfigured?
On Solaris, I get the following in a config.h /* STDCHAR: * This symbol is defined to be the type of char used in stdio.h. * It has the values "unsigned char" or "char". */ #define STDCHAR unsigned char /**/ Here are the warnings that are coming up during the compile. /opt/SUNWspro/bin/cc -c -D_REENTRANT -DPTR_IS_LONG -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g -DVERSION=\"0.14\" -DXS_VERSION=\"0.14\" -KPIC "-I/tmp/bleadperl/lib/5.10.0/i86pc-solaris-thread-multi-64int-ld/CORE" eol.c "eol.xs", line 29: warning: assignment type mismatch: pointer to unsigned char "=" pointer to char "eol.xs", line 32: warning: assignment type mismatch: pointer to unsigned char "=" pointer to char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 148 argument : pointer to unsigned char "eol.xs", line 50: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 148 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 89 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 148 argument : pointer to unsigned char "eol.xs", line 51: warning: argument #1 is incompatible with prototype: prototype: pointer to const char : "/usr/include/iso/string_iso.h", line 148 argument : pointer to unsigned char "eol.xs", line 157: warning: assignment type mismatch: pointer to unsigned char "=" pointer to char These are the prototypes for the following functions.... extern int strncmp(const char *, const char *, size_t); extern char *strchr(const char *, int); Since STDCHAR on Solaris is an unsigned char, the automatic converions from unsigned char * to const char * causes the warnings to appear. The second problem occurs when the return from savepv() is stored as an unsigned char *. According to proto.h... proto.h:PERL_CALLCONV char* Perl_savepv(pTHX_ const char* pv) ...so instead of what I have sent, the patch should be if (f) { PerlIOEOL *s = PerlIOSelf(f, PerlIOEOL); - s->name = savepv( SvPV_nolen(arg) ); + s->name = (STDCHAR *)savepv( SvPV_nolen(arg) ); } so its right across environments.
Rejecting this patch as OLD/INVALID as it seems that the Perl headers on the system were misconfigured. Please let me know if you need anything else. Regards, -- Shlomi Fish
On 2016-04-26 09:39:21, SHLOMIF wrote: Show quoted text
> Rejecting this patch as OLD/INVALID as it seems that the Perl headers > on the system were misconfigured. Please let me know if you need > anything else.
I am pretty sure that this is not a question of a misconfigured perl. Please read the comments in perl's config.h --- it says: /* STDCHAR: * This symbol is defined to be the type of char used in stdio.h. * It has the values "unsigned char" or "char". */ On systems where STDCHAR is set to "unsigned char" it's clear that the warnings happen (SvPV etc. return char*, not unsigned char*). It just not happen on today's mainstream OS like linux and *bsd. Regards, Slaven
Hi Slaven, On Fri Apr 29 03:09:14 2016, SREZIC wrote: Show quoted text
> On 2016-04-26 09:39:21, SHLOMIF wrote:
> > Rejecting this patch as OLD/INVALID as it seems that the Perl headers > > on the system were misconfigured. Please let me know if you need > > anything else.
> > I am pretty sure that this is not a question of a misconfigured perl. > Please read the comments in perl's config.h --- it says: > > /* STDCHAR: > * This symbol is defined to be the type of char used in stdio.h. > * It has the values "unsigned char" or "char". > */ > > On systems where STDCHAR is set to "unsigned char" it's clear that the > warnings happen (SvPV etc. return char*, not unsigned char*). It just > not happen on today's mainstream OS like linux and *bsd. >
Do you mean that "STDCHAR *" is used by stdio.h and string.h and PerlIO routines should use "char *" globally? I'm not an XS expert. Perhaps I should ask that on the Perl/XS mailing list. Regards, -- Shlomi Show quoted text
> Regards, > Slaven
One should also note that STDCHAR appears here - http://perldoc.perl.org/perliol.html . Regards, -- Shlomi Fish
On 2016-04-29 04:03:37, SHLOMIF wrote: Show quoted text
> One should also note that STDCHAR appears here - > http://perldoc.perl.org/perliol.html .
Sure --- the proposed patch did not replace every occurrence of STDCHAR in eol.xs, only the ones where the unsigned/signed char confusion happened.
On Fri Apr 29 17:49:16 2016, SREZIC wrote: Show quoted text
> On 2016-04-29 04:03:37, SHLOMIF wrote:
> > One should also note that STDCHAR appears here - > > http://perldoc.perl.org/perliol.html .
> > Sure --- the proposed patch did not replace every occurrence of > STDCHAR in eol.xs, only the ones where the unsigned/signed char > confusion happened.
Thanks! I applied the patch manually in version 0.16, which was uploaded to CPAN. Closing the ticket.