#1110369 Debhelper/Buildsystem.pm: blank in $cwd crashes build

Package:
libdebhelper-perl
Source:
libdebhelper-perl
Submitter:
Steffen Moeller
Date:
2025-08-31 07:35:02 UTC
Severity:
normal
Tags:
#1110369#5
Date:
2025-08-03 23:35:47 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

This was triggered while attemting to harden first the execution and
then the build of LinuxCNC.
Many scripts of that package had missing quotes in shell scripts
and thus were susceptible to blanks or other unexpected characters
in file names.

We found that it still fails when a directory in the path to the
build directory had a blank, invoking "make" directly. I had now
tried to invoke it via dpkg-buildpackage and, well, it did not get
very far.

https://github.com/LinuxCNC/linuxcnc/pull/3309 gives a bit of context
from our side.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

The directory I cloned linuxcnc into I renamed to "linux cnc",
entered it (cd !$ worked fine), ran ./debian/configure no-docs,
then dpkg-buildpackage.

   * What was the outcome of this action?

make[1]: Entering directory '/home/moeller/GitHub/linux cnc'
dh_auto_build -- build-software
date: invalid date '@'
date: invalid date '@'
Use of uninitialized value $abspath in -d at /usr/share/perl5/Debian/Debhelper/Buildsystem.pm line 140.

Comment: It is a trivial "if ( -d $abspath " that is apparently missing
some quotes. But there is likely more to it downstream.

dh_auto_build: error: invalid or non-existing path to the source directory: /home/moeller/GitHub/linuxcnc/src

Comment: THat path is indeed not existing. I had renamed "linuxcnc" to
"linux cnc" for this test. Same shell, nothing logged in from somewhere
else or so.

make[1]: *** [debian/rules:55: override_dh_auto_build-arch] Error 255
make[1]: Leaving directory '/home/moeller/GitHub/linux cnc'
make: *** [debian/rules:43: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
moeller@mariner1:/home/moeller/GitHub/linux cnc$

   * What outcome did you expect instead?

The error in the LinuxCNC Makefile with its very own path expansion
should have surfaced. This is much earlier.

It would be lovely to add to the CI the execution of various debhelper
utils from a directory that has a blank in its name.

#1110369#10
Date:
2025-08-04 05:12:48 UTC
From:
To:
Steffen Moeller:

Hi,

Thanks for filing the bug.

I am open to reviewing patches or MRs to solve problems and add working
CI pipelines involving spaces to avoid regressions. However, I do not
expect to commit time solve this problem.

Perl and shell differs here:

$ touch "foo bar"
$ perl -E 'my $f = "foo bar"; say "exists" if -e $f;'
exists

Not disputing that there is an error in debhelper, but the error is not
missing quotes in that if statement.

For what it is worth, debhelper can run dh_auto_build in its own build
when the source directory contains a space. A few of tests fail because
they are not space-safe in dh_auto_test (for some reason @INC gets
corrupted and I am not sure how).


Best regards,
Niels

#1110369#15
Date:
2025-08-04 05:12:48 UTC
From:
To:
Steffen Moeller:

Hi,

Thanks for filing the bug.

I am open to reviewing patches or MRs to solve problems and add working
CI pipelines involving spaces to avoid regressions. However, I do not
expect to commit time solve this problem.

Perl and shell differs here:

$ touch "foo bar"
$ perl -E 'my $f = "foo bar"; say "exists" if -e $f;'
exists

Not disputing that there is an error in debhelper, but the error is not
missing quotes in that if statement.

For what it is worth, debhelper can run dh_auto_build in its own build
when the source directory contains a space. A few of tests fail because
they are not space-safe in dh_auto_test (for some reason @INC gets
corrupted and I am not sure how).


Best regards,
Niels