[debhelper-devel] Bug#198507: dh_install: fails if filenames have an embedded space

Niels Thykier niels at thykier.net
Sat Oct 1 11:26:00 UTC 2016


Hi Gergely,

I would like to fix the following bug, but I would prefer to do it in a
way that also worked for dh-exec:

On Mon, 23 Jun 2003 09:59:52 -0400 Joe Nahmias <joe at nahmias.net> wrote:
> Package: debhelper
> Version: 4.1.45
> Severity: normal
> 
> [...]
> 
> Hello,
> 
> 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
> 
> [...]
> 
> Thanks,
> Joe Nahmias
> 
> 
> [...]

A couple of points/ideas:

 * dh-exec and debhelper should /preferably/ agree on users write their
   spaces to be preserved (so the interface is the same for users with
   and without dh-exec).

 * The internal communication between dh-exec and debhelper does not
   have to be the same as the input format.  Especially not if it would
   save you trouble of having to do complex "decode and recode" cycles

For internal communication, this could be something as "simple" as using
the ASCII record (0x1E) separators.  An example could be

  #<some directive to change parsing mode> \n
  <filenameA> 0x1E <filenameB> 0x1E <dirnameA> \n
  <filenameB> 0x1E <filenameD> 0x1E <dirnameB> \n
  <filenameE> 0x1E <dirnameC> \n
  ...
(debhelper would signal the support for that via an ENV variable)

For dh-exec, this would probably mean you would have to use this as
internal communication between the scripts as well.  This could be done
by having an "input" script a la:

 dh-exec-input-parser | ... | dh-exec-output

(With dh-exec-output supporting the old output format for older debhelpers).

As an example, dh-exec-install-rename would go from:

  if (/([^\s]*)\s+=>\s+([^\s]*)/ || /^=>\s+([^\s]*)/) {
    ...
  }
  ...

  $_ .= " " . $dstpath if ($append_destpath eq TRUE);

To something like (untested):

  if (/([^\x1e]*)\x1e=>\x1e([^\x1e]*)/ || /^=>\x1e([^\x1e]*)/) {
    ...
  }
  ...
  $_ .= "\x1e" . $dstpath if ($append_destpath eq TRUE);

(possible with /x and some inline spaces to make it more readable).


AFAICT, this method would:

 * avoid having to add (complex) decode+encode in all the scripts
 * put all the parsing of the user-formatted input in one place for
   dh-exec.
 * put all compatibility handling with debhelper in one place

This still leaves the question of the input format.  If you have any
suggestions for that or alternatives, please let me know. :)

Thanks,
~Niels




More information about the debhelper-devel mailing list