Re: [debhelper-devel] Bug#198507: dh_install: fails if filenames have an embedded space
Ben Hutchings:
> On Sun, 2017-07-09 at 19:58 +0000, Niels Thykier wrote:
>> Ben Hutchings:
>>> It looks like this was quietly fixed somewhere between 10.2.5 and
>>> 10.6.2, maybe in 10.5.1 by:
>>>
>>> * dh_install: Optimize some patterns into bulked "cp" calls. This
>>> optimization is only applicable in some cases (notably, it is always
>>> disabled by --exclude).
>>>
>>> This actually broke src:linux as we accidentally relied on dh_install
>>> breaking at spaces. We'll fix that, but you might want to make the
>>> change dependent on compat level in case it breaks other packages.
>>> Possibly the change in 10.6.3 does that.
>>>
>>> Ben.
>>>
>>> [...]
>>
>> Hmm, that is interesting. Said optimization was disabled in 10.6.1 (by
>> making it conditional on compat 11) and the rewritten for 10.6.3. That
>> suggests it is a different thing happening. Probably caused by the
>> rewrite of the glob expansion though.
>>
>> I am a bit surprised why this would occur as AFAICT the splitting on
>> space happens during parsing, which I have left unchanged.
>>
>> Can you provide an example of what worked before that now breaks. If I
>> can get a minimal test case up and running, I can probably bisect the
>> code and figure out exactly where it breaks.
>
> We're using compat 9 and the failing command is:
>
> dh_install 'debian/build/linux-source-4.11.tar.xz debian/build/linux-patch-4.11-rt.patch.xz' /usr/src
>
> Ben.
>
Definitely, the glob-rewrite then.
Could you try to see if the following patch fixes the issue for you?
"""
$ git diff
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 56ebeaf2..8312afea 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -37,7 +37,7 @@ my %NAMED_COMPAT_LEVELS = (
use Errno qw(ENOENT);
use Exporter qw(import);
-use File::Glob qw(bsd_glob GLOB_CSH GLOB_NOMAGIC GLOB_TILDE);
+use File::Glob qw(bsd_glob csh_glob GLOB_CSH GLOB_NOMAGIC GLOB_TILDE);
our (@EXPORT, %dh);
@EXPORT=qw(&init &doit &doit_noerror &complex_doit &verbose_print &error
&nonquiet_print &print_and_doit &print_and_doit_noerror
@@ -990,8 +990,9 @@ sub glob_expand {
for my $pattern (@patterns) {
my @m;
for my $dir (@dirs) {
- @m = bsd_glob("$dir/$pattern", GLOB_CSH &
~(GLOB_NOMAGIC|GLOB_TILDE));
- last if @m;# > 1 or (@m and (-l $m[0] or -e _));
+ @m = compat(10) ? csh_glob("$dir/$pattern",
GLOB_CSH & ~(GLOB_NOMAGIC|GLOB_TILDE))
+ : bsd_glob("$dir/$pattern", GLOB_CSH &
~(GLOB_NOMAGIC|GLOB_TILDE));
+ last if @m;
}
if (not @m) {
$error_handler //=
\&glob_expand_error_handler_reject;
"""
Thanks,
~Niels
Reply to: