[debhelper-devel] Bug#198507: dh_install: fails if filenames have an embedded space
Gergely Nagy
algernon at madhouse-project.org
Wed Oct 5 07:15:36 UTC 2016
Hi!
>>>>> "Niels" == Niels Thykier <niels at thykier.net> writes:
Niels> On Mon, 23 Jun 2003 09:59:52 -0400 Joe Nahmias <joe at nahmias.net> wrote:
Now, this is quite an ancient issue! :D
>> dh_install has problems handling files listed in debian/pkgname.install
>> when the filename contains (an) embedded space(s). For example, when
>> debian/fceu-doc.install contains the line:
>>
>> Documentation/tech/ppu/2C02\ technical\ operation.TXT usr/share/doc/fceu-doc/tech/
>>
>> the following results:
>>
>> dh_install
>> cp: cannot stat `./Documentation/tech/ppu/2C02\\': No such file or directory
>> dh_install: command returned error code 256
>> make: *** [install] Error 1
Niels> A couple of points/ideas:
Niels> * dh-exec and debhelper should /preferably/ agree on users write their
Niels> spaces to be preserved (so the interface is the same for users with
Niels> and without dh-exec).
Agreed. I'll see if there are any parts of dh-exec that need to handle
spaces better. My gut feeling is, that apart from
dh-exec-install-rename, there aren't any.
Niels> * The internal communication between dh-exec and debhelper does not
Niels> have to be the same as the input format. Especially not if it would
Niels> save you trouble of having to do complex "decode and recode" cycles
Right now, dh-exec just preprocesses the file, there is no special
communication protocol, and for the sake of simplicity, I'd prefer if
this stayed that way. Otherwise I'd have to rewrite most of it.
That is, I'd like to keep the internal communication format the same as
it is today, free of any special dh-exec <=> debhelper stuff. What
dh-exec spits out in the end, should be treated as a traditional
debhelper control file. If any other communication needs to be done
(which would mostly mean debhelper telling dh-exec some more info), that
should be in environment variables - just like it is now.
Niels> As an example, dh-exec-install-rename would go from:
Niels> if (/([^\s]*)\s+=>\s+([^\s]*)/ || /^=>\s+([^\s]*)/) {
Niels> ...
Niels> }
Niels> ...
Niels> $_ .= " " . $dstpath if ($append_destpath eq TRUE);
Niels> To something like (untested):
Niels> if (/([^\x1e]*)\x1e=>\x1e([^\x1e]*)/ || /^=>\x1e([^\x1e]*)/) {
Niels> ...
Niels> }
Niels> ...
Niels> $_ .= "\x1e" . $dstpath if ($append_destpath eq TRUE);
Niels> (possible with /x and some inline spaces to make it more readable).
Mmmm... I'd rather change the regexp to be a bit more lenient about
spaces. It originally had (.*), and that was changed to disallowing
spaces only to avoid being greedy and treat "foo => bar" as an
instruction to rename "foo " to "bar".
Instead, I could just use .*, and strip the spaces at the end, unless
they are escaped. That is a lot less code for both dh-exec and
debhelper: I only have to change dh-exec, and debhelper does not need
any dh-exec-specific code.
Niels> * avoid having to add (complex) decode+encode in all the
Niels> scripts
dh-exec does not need complex decode+encode steps. At least, not more
than it already does have. It just adds some extra sugar on top of the
debhelper-understood format, and writes out the same format users would
write. I think this design is fine, and just this case alone is not a
reason enough to change this.
Niels> * put all the parsing of the user-formatted input in one place for
Niels> dh-exec.
This would be useful, if there were other places than -install-rename
where this matters, but there isn't, and I don't really see this
changing in the future.
Niels> * put all compatibility handling with debhelper in one place
Well, it's already in one place, pretty much, the only place that needs
it. :)
If there will be more places that need this special handling, I can
still easily pull out the functions that do the decoding/encoding,
without having to change debhelper itself.
Niels> This still leaves the question of the input format. If you have any
Niels> suggestions for that or alternatives, please let me know. :)
My suggestion is: don't change the format. I'll make dh-exec handle
spaces in the rename script. You only need to teach debhelper to handle
the \-escaped spaces.
The dh-exec part of this is about 10 lines plus tests, at a guess. Doing
the \x1e separator thing would be considerably more, and as such, I'd
opt for the easier solution.
--
|8]
More information about the debhelper-devel
mailing list