Skip to content
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

Bleadperl v5.19.0-57-g6d5abc6 breaks SREZIC/Tk-804.031.tar.gz #12997

Closed
p5pRT opened this issue May 26, 2013 · 9 comments
Closed

Bleadperl v5.19.0-57-g6d5abc6 breaks SREZIC/Tk-804.031.tar.gz #12997

p5pRT opened this issue May 26, 2013 · 9 comments

Comments

@p5pRT
Copy link

p5pRT commented May 26, 2013

Migrated from rt.perl.org#118189 (status was 'resolved')

Searchable as RT118189$

@p5pRT
Copy link
Author

p5pRT commented May 26, 2013

From @andk

git bisect


6d5abc6 is the first bad commit
commit 6d5abc6
Author​: Nicholas Clark <nick@​ccl4.org>
Date​: Wed Mar 6 16​:27​:08 2013 +0100

  Change LIKELY() and UNLIKELY() to cast their first argument to a bool.
 
  This avoids problems such as pointers being compared with the literal value 1.
  Suggested by Zefram.
 
  Note that this is technically a change of behaviour, as the macro EXPECT(),
  which they are both both wrappers for, returns its value, so they will now
  be returning TRUE or FALSE, rather than the actual value passed to them.
  However, all uses in the core and on CPAN are only within if() statements, so
  this should not make any difference in practice.

diagnostics


Xlib.xs​: In function ‘XS_DisplayPtr_XListFonts’​:
Xlib.xs​:230​:66​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:230​:66​: note​: each undeclared identifier is reported only once for each function it appears in
Xlib.xs​:230​:71​: error​: expected ‘​:’ before numeric constant
Xlib.xs​: In function ‘XS_DisplayPtr_XQueryTree’​:
Xlib.xs​:321​:67​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:321​:72​: error​: expected ‘​:’ before numeric constant
make[1]​: *** [Xlib.o] Error 1
make[1]​: Leaving directory `/tmp/makeperl-zi8Jpn/Tk-804.031-7oBTHn/Xlib'

perl -V


Summary of my perl5 (revision 5 version 19 subversion 1) configuration​:
  Commit id​: 6d5abc6
  Platform​:
  osname=linux, osvers=3.8-2-amd64, archname=x86_64-linux
  uname='linux k83 3.8-2-amd64 #1 smp debian 3.8.13-1 x86_64 gnulinux '
  config_args='-Dprefix=/home/src/perl/repoperls/installed-perls/perl/v5.19.0-57-g6d5abc6/165a -Dmyhostname=k83 -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Uuseithreads -Uuselongdouble -DDEBUGGING=-g'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2 -g',
  cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.7.3', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.17'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
  PERL_PRESERVE_IVUV PERL_SAWAMPERSAND PERL_USE_DEVEL
  USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES
  USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Built under linux
  Compiled at May 26 2013 21​:25​:52
  @​INC​:
  /home/src/perl/repoperls/installed-perls/perl/v5.19.0-57-g6d5abc6/165a/lib/site_perl/5.19.1/x86_64-linux
  /home/src/perl/repoperls/installed-perls/perl/v5.19.0-57-g6d5abc6/165a/lib/site_perl/5.19.1
  /home/src/perl/repoperls/installed-perls/perl/v5.19.0-57-g6d5abc6/165a/lib/5.19.1/x86_64-linux
  /home/src/perl/repoperls/installed-perls/perl/v5.19.0-57-g6d5abc6/165a/lib/5.19.1
  .

--
andreas

@p5pRT
Copy link
Author

p5pRT commented May 26, 2013

From @jkeenan

On Sun May 26 12​:55​:10 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

git bisect
----------
6d5abc6 is the first bad commit
commit 6d5abc6
Author​: Nicholas Clark <nick@​ccl4.org>
Date​: Wed Mar 6 16​:27​:08 2013 +0100

Change LIKELY\(\) and UNLIKELY\(\) to cast their first argument to a

bool.

This avoids problems such as pointers being compared with the

literal value 1.
Suggested by Zefram.

Note that this is technically a change of behaviour\, as the macro

EXPECT(),
which they are both both wrappers for, returns its value, so they
will now
be returning TRUE or FALSE, rather than the actual value passed to
them.
However, all uses in the core and on CPAN are only within if()
statements, so
this should not make any difference in practice.

diagnostics
-----------
Xlib.xs​: In function ‘XS_DisplayPtr_XListFonts’​:
Xlib.xs​:230​:66​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:230​:66​: note​: each undeclared identifier is reported only once
for each function it appears in
Xlib.xs​:230​:71​: error​: expected ‘​:’ before numeric constant
Xlib.xs​: In function ‘XS_DisplayPtr_XQueryTree’​:
Xlib.xs​:321​:67​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:321​:72​: error​: expected ‘​:’ before numeric constant
make[1]​: *** [Xlib.o] Error 1
make[1]​: Leaving directory `/tmp/makeperl-zi8Jpn/Tk-804.031-
7oBTHn/Xlib'

Is this the same as, or different from, 114422?

@p5pRT
Copy link
Author

p5pRT commented May 26, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @andk

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

Is this the same as, or different from, 114422?

Not.

--
andreas

@p5pRT
Copy link
Author

p5pRT commented May 28, 2013

From @eserte

Andreas Koenig <andreas.koenig.7os6VVqR@​franz.ak.mind.de> writes​:

git bisect
----------
6d5abc6 is the first bad commit
commit 6d5abc6
Author​: Nicholas Clark <nick@​ccl4.org>
Date​: Wed Mar 6 16​:27​:08 2013 +0100

Change LIKELY\(\) and UNLIKELY\(\) to cast their first argument to a bool\.

This avoids problems such as pointers being compared with the literal value 1\.
Suggested by Zefram\.

Note that this is technically a change of behaviour\, as the macro EXPECT\(\)\,
which they are both both wrappers for\, returns its value\, so they will now
be returning TRUE or FALSE\, rather than the actual value passed to them\.
However\, all uses in the core and on CPAN are only within if\(\) statements\, so
this should not make any difference in practice\.

diagnostics
-----------
Xlib.xs​: In function ‘XS_DisplayPtr_XListFonts’​:
Xlib.xs​:230​:66​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:230​:66​: note​: each undeclared identifier is reported only once for each function it appears in
Xlib.xs​:230​:71​: error​: expected ‘​:’ before numeric constant
Xlib.xs​: In function ‘XS_DisplayPtr_XQueryTree’​:
Xlib.xs​:321​:67​: error​: ‘bool’ undeclared (first use in this function)
Xlib.xs​:321​:72​: error​: expected ‘​:’ before numeric constant
make[1]​: *** [Xlib.o] Error 1
make[1]​: Leaving directory `/tmp/makeperl-zi8Jpn/Tk-804.031-7oBTHn/Xlib'

Commit c6441755d78aaa29725c8c2ff91b244f7a25d967 in
git​://github.com/eserte/perl-tk seems to fix it. Unfortunately I don't
know why the "#undef bool" was ever done, the changelogs are quite
sparse here... maybe some misbehaving compilers?

Regards,
  Slaven

--
Slaven Rezic - slaven <at> rezic <dot> de
  BBBike - route planner for cyclists in Berlin
  WWW version​: http​://www.bbbike.de
  Perl/Tk version for Unix and Windows​: http​://bbbike.sourceforge.net

@p5pRT
Copy link
Author

p5pRT commented May 28, 2013

From @nwc10

On Tue, May 28, 2013 at 11​:32​:31AM -0700, slaven@​rezic.de wrote​:

Commit c6441755d78aaa29725c8c2ff91b244f7a25d967 in
git​://github.com/eserte/perl-tk seems to fix it. Unfortunately I don't
know why the "#undef bool" was ever done, the changelogs are quite
sparse here... maybe some misbehaving compilers?

Having cloned the history from gitpan, I'm going to have a guess that it's
due to this​:

Inline Patch
diff --git a/pTk/mTk/generic/tkEntry.c b/pTk/mTk/generic/tkEntry.c
index b3507d8..ca3b006 100644
--- a/pTk/mTk/generic/tkEntry.c
+++ b/pTk/mTk/generic/tkEntry.c


 static int
 EntryValidate(entryPtr, cmd, string)
-     register Entry *entryPtr; /* Entry that needs validation. */
-     register LangCallback *cmd;       /* Validation command (NULL-terminated
+     register Entry *entryPtr;  /* Entry that needs validation. */
+     register LangCallback *cmd;        /* Validation command (NULL-terminated
                                 * string). */
      char *string;
 {
-    int code;
-    Arg result;
+    register Tcl_Interp *interp = entryPtr->interp;
+    int code, bool;
 
     code = LangDoCallback(entryPtr->interp, cmd, 1, 1, "%s", string);
 
+    /*
+     * We accept TCL_OK and TCL_RETURN as valid return codes from the
+     * command callback.
+     */
     if (code != TCL_OK && code != TCL_RETURN) {
-       Tcl_AddErrorInfo(entryPtr->interp,
-                "\n\t(in validation command executed by entry)");
-       Tcl_BackgroundError(entryPtr->interp);
+       Tcl_AddErrorInfo(interp, "\n\t(in validation command executed by ");
+       Tcl_AddErrorInfo(interp, Tk_PathName(entryPtr->tkwin));
+       Tcl_AddErrorInfo(interp, ")");
+       Tcl_BackgroundError(interp);
        return TCL_ERROR;
     }
 
-    result = Tcl_ResultArg(entryPtr->interp);
-
-    if (Tcl_GetBoolean(entryPtr->interp,  result, &code) != TCL_OK) {
-       Tcl_AddErrorInfo(entryPtr->interp,
-                "\nValid Tcl Boolean not returned by validation command");
-       Tcl_BackgroundError(entryPtr->interp);
-       Tcl_SetResult(entryPtr->interp, (char *) NULL, TCL_STATIC);
+    /*
+     * The command callback should return an acceptable Tcl boolean.
+     */
+    if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp),
+                             &bool) != TCL_OK) {



which adds a local variable named bool. I guess that this is imported code from upstream Tk\.

Having a #define for bool would not be compatible with that code.

That code is still present today. It's wrapped with #ifndef _LANG
which seems to have been added by you in

commit 1c1516490f0fe5d017db57a3c2ca11251b16e1c3
Author​: Slaven Rezic <slaven@​rezic.de>
Date​: Tue Dec 4 13​:03​:29 2007 -0800

  import Tk 804.027_502 from CPAN
 
  git-cpan-module​: Tk
  git-cpan-version​: 804.027_502
  git-cpan-authorid​: SREZIC
  git-cpan-file​: authors/id/S/SR/SREZIC/Tk-804.027_502.tar.gz

I don't know the significance of _LANG, but if there's a platform where it
isn't defined, that code is no longer going to compile, thanks to that
variable named "bool".

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented May 28, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 28, 2013

From @eserte

"Nicholas Clark via RT" <perlbug-followup@​perl.org> writes​:

On Tue, May 28, 2013 at 11​:32​:31AM -0700, slaven@​rezic.de wrote​:

Commit c6441755d78aaa29725c8c2ff91b244f7a25d967 in
git​://github.com/eserte/perl-tk seems to fix it. Unfortunately I don't
know why the "#undef bool" was ever done, the changelogs are quite
sparse here... maybe some misbehaving compilers?

Having cloned the history from gitpan, I'm going to have a guess that it's
due to this​:

[...]

I don't know the significance of _LANG, but if there's a platform where it
isn't defined, that code is no longer going to compile, thanks to that
variable named "bool".

Hello Nicholas,

thanks for the research. As _LANG is always defined when compiling
Perl/Tk (or any other language using NI-S' Portable Tk idea), removing
the "#undef bool" doesn't seem to be a problem.

Regards,
  Slaven

--
Slaven Rezic - slaven <at> rezic <dot> de
  BBBike - route planner for cyclists in Berlin
  WWW version​: http​://www.bbbike.de
  Perl/Tk version for Unix and Windows​: http​://bbbike.sourceforge.net

@p5pRT
Copy link
Author

p5pRT commented May 29, 2013

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant