Bug#887571: debhelper: dh lies about what it does, breaks builds by creating new files, etc

2018-01-17 Thread Norbert Preining
Package: debhelper
Version: 11.1.2
Severity: serious
Justification: breaks other packages

Dear DebHelper developers,

thanks for your efforts, but it would be very helpful if debhelper/dh
would stick to what itself says it is doing.

I am trying to build texlive-bin, and somewhere at/around the configure
stage files
  configure.lineno
are created, which break building:
  checking whether g++ accepts -g... no
  checking dependency style of g++... none
  checking what warning flags to pass to the Objective C++ compiler...
  ../../../texk/web2c/configure: 20010: ./configure.lineno: Syntax error: Bad 
fd number
  === configuring in web2c failed

I confirmed the following:
* doing the same invocation of configure manually does NOT create
  configure.lineno and the build succeeds.
* what dh says it is doing with 
dh binary --no-act ...
  is *different* from what is actually happening, since doing the exact
  same things as listed by dh binary --no-act immediately breaks

Example for this (the reautoconf stage has already been done):
  $ dh binary --no-act --with autoreconf --builddirectory Work
  debian/rules override_dh_auto_configure
  dh_auto_build -O--builddirectory=Work
  dh_auto_test -O--builddirectory=Work

But doing
  $ debian/rules override_dh_auto_configure
breaks becasue it does not change into Work before calling configure.

Adding the obviously necessary
  DH_INTERNAL_BUILDFLAGS=1
  DH_INTERNAL_OPTIONS=-O--builddirectory=Work
  DH_INTERNAL_OVERRIDE=dh_auto_configure
make the above command work, but somewhere/somehow starts creating
configure.lineno files, while doing the configure.

Calling make -f debian/rules binary I see the following:
$ make -f debian/rules binary
dh binary --with autoreconf --builddirectory Work
   debian/rules override_dh_auto_configure
make[1]: Entering directory 
'/home/norbert/Development/TeX/debian/git/build-area/texlive-bin-2018.20180118.46355'
# we have to make sure that the mendex test case that is added
# by a patch is executable
chmod 0755 texk/mendexk/tests/mendex.test
# run out configure script
dh_auto_configure -- -C --prefix=/usr   \
--datarootdir=/usr/share/texlive\
--disable-native-texlive-build  \
 OTHER configure args
--enable-ipc
cd Work && ../configure --build=x86_64-linux-gnu --prefix=/usr 
--includedir=\${prefix}/include --mandir=\${prefix}/share/man 
--infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var 
--disable-silent-rules --libdi
  
configure: creating cache config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc

and at this time
  configure.lineno
is already existing, and propagated down the tree and breaking the build
builds.

But doing by hand, EVEN with the above three env variables set, doing
only the
  cd Work && ../configure --build=x86_64-lin ...
part does NOT create configure.lineno.


Also running
  dh_auto_configure -- -C --prefix=/usr \
--datarootdir=/usr/share/texlive\
  
does NOT create configure.lineno.

As a consequence, the only remaining candidate is that 
  dh
does *something*else* before calling the targets or setting env vars.

This is extremely difficult to debug without a proper documentation and
completely unreproducible behaviour from dh.

It is hard to guess what happens here, and I would be very grateful for
an expanation what else dh is doing before calling the actual things it
says it is calling.

Best

Norbert

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.13 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages debhelper depends on:
ii  autotools-dev20171216.1
ii  binutils 2.29.1-13
ii  dh-autoreconf15
ii  dh-strip-nondeterminism  0.040-1
ii  dpkg 1.19.0.4
ii  dpkg-dev 1.19.0.4
ii  file 1:5.32-1
ii  libdpkg-perl 1.19.0.4
ii  man-db   2.7.6.1-4
ii  perl 5.26.1-4
ii  po-debconf   1.0.20

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make  
pn  dwz  

-- no debconf information



Bug#887571: [debhelper-devel] Bug#887571: debhelper: dh lies about what it does, breaks builds by creating new files, etc

2018-01-17 Thread Niels Thykier
Control: tags -1 moreinfo

Norbert Preining:
> Package: debhelper
> Version: 11.1.2
> Severity: serious
> Justification: breaks other packages
> 
> Dear DebHelper developers,
> 
> thanks for your efforts, but it would be very helpful if debhelper/dh
> would stick to what itself says it is doing.
> 
> I am trying to build texlive-bin, and somewhere at/around the configure
> stage files
>   configure.lineno
> are created, which break building:
>   checking whether g++ accepts -g... no
>   checking dependency style of g++... none
>   checking what warning flags to pass to the Objective C++ compiler...
>   ../../../texk/web2c/configure: 20010: ./configure.lineno: Syntax error: Bad 
> fd number
>   === configuring in web2c failed
> 
> I confirmed the following:
> * doing the same invocation of configure manually does NOT create
>   configure.lineno and the build succeeds.

I suspect it might be the shell.  Make resets SHELL to /bin/sh AFAIR and
the error smells like a bashism with a non-bash shell.

Could you please retest with "export SHELL=/bin/bash" set in your
debian/rules (or a SHELL=/bin/bash in front of the dh_auto_configure call).

> * what dh says it is doing with 
> dh binary --no-act ...
>   is *different* from what is actually happening, since doing the exact
>   same things as listed by dh binary --no-act immediately breaks
> 
> Example for this (the reautoconf stage has already been done):
>   $ dh binary --no-act --with autoreconf --builddirectory Work
>   debian/rules override_dh_auto_configure
>   dh_auto_build -O--builddirectory=Work
>   dh_auto_test -O--builddirectory=Work
> > [...]
> 
> Best
> 
> Norbert
> 
> [...]

The missing options/incomplete cmd-line is related to #552276.

Thanks,
~Niels



Bug#887571: [debhelper-devel] Bug#887571: debhelper: dh lies about what it does, breaks builds by creating new files, etc

2018-01-17 Thread Niels Thykier
Niels Thykier:
> Control: tags -1 moreinfo
> 
> Norbert Preining:
>> Package: debhelper
>> Version: 11.1.2
>> Severity: serious
>> Justification: breaks other packages
>>
>> Dear DebHelper developers,
>>
>> thanks for your efforts, but it would be very helpful if debhelper/dh
>> would stick to what itself says it is doing.
>>
>> I am trying to build texlive-bin, and somewhere at/around the configure
>> stage files
>>   configure.lineno
>> are created, which break building:
>>   checking whether g++ accepts -g... no
>>   checking dependency style of g++... none
>>   checking what warning flags to pass to the Objective C++ compiler...
>>   ../../../texk/web2c/configure: 20010: ./configure.lineno: Syntax error: 
>> Bad fd number
>>   === configuring in web2c failed
>>
>> I confirmed the following:
>> * doing the same invocation of configure manually does NOT create
>>   configure.lineno and the build succeeds.
> 
> I suspect it might be the shell.  Make resets SHELL to /bin/sh AFAIR and
> the error smells like a bashism with a non-bash shell.
> 
> Could you please retest with "export SHELL=/bin/bash" set in your
> debian/rules (or a SHELL=/bin/bash in front of the dh_auto_configure call).
> 

Ah, just noticed you have the following in top of the rules file which
makes my above statement redundant.

"""
#!/usr/bin/make -f
# debian/rules file for texlive-bin

export SHELL=/bin/bash
export CONFIG_SHELL=/bin/sh
"""

 * When you test manually, do you also set CONFIG_SHELL to /bin/sh?
   (Just to eliminate a source of error/difference)

Thanks,
~Niels



Bug#887571: [debhelper-devel] Bug#887571: debhelper: dh lies about what it does, breaks builds by creating new files, etc

2018-01-17 Thread Norbert Preining
Hi Niels,

> I suspect it might be the shell.  Make resets SHELL to /bin/sh AFAIR and
> the error smells like a bashism with a non-bash shell.

> export CONFIG_SHELL=/bin/sh

This has been there since around 6 years ... so I am a bit surprised
that this might have an influence, but I am retesting just now ...

Thanks

Norbert

--
PREINING Norbert   http://www.preining.info
Accelia Inc. +JAIST +TeX Live +Debian Developer
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13