[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#281562: [DPKG-DEB] -b does not find conffiles if they have spaces at the end



On Tue, 2004-11-16 at 18:31 +0000, Scott James Remnant wrote:
> On Tue, 2004-11-16 at 18:35 +0100, David L. Moreno wrote:
> 
> > When building a package, dpkg-deb stopped with this error:
> > 
> > dpkg-deb: conffile `etc/robplayer/usc_pioneer.cfg ' does not appear in
> > package
> > 
> Is the filename on disk "etc/robplayer/usc_pioneer.cfg" or
> "etc/robplayer/usc_pioneer.cfg " ?

The filename on disk is "etc/robplayer/usc_pioneer.cfg", but it could
have a whitespace at the end, I didn't think of that.

Probably, it's better to give a warning about trailing spaces when
lstat() fails, so the user can write the conffile entries properly.
Removing spaces without asking is rude and could make dpkg-deb misbehave
if the conffile filename actually has a trailing whitespace.

The attached patch will produce this output if the filename does not
have a trailing whitespace but it is written with one on
debian/conffiles:

dpkg-deb: building package `robplayer' in `../robplayer_1.5-1_i386.deb'.
warning, conffile filename `etc/robplayer/usc_pioneer.cfg ' contains
trailing white spaces
dpkg-deb: conffile `etc/robplayer/usc_pioneer.cfg ' does not appear in
package


Dave

-- 
David L. Moreno (david.lopez.moreno at hispalinux.es)
GNU/Linux
Debian SID (2.6.6-1) i686 PentiumIII
Gentoo 1.4rc2 (2.4.20) sparc64(sun4u) UltraSparc I (SpitFire)
GPG Public Key at: http://www-gsi.dec.usc.es/~dave/pub_key.asc 
Key ID: 761BF242
*** build.c.orig	Thu Nov 11 21:10:03 2004
--- build.c	Wed Nov 17 09:00:10 2004
***************
*** 286,294 ****
          strcat(controlfile, "/");
          strcat(controlfile, conffilename);
          if (lstat(controlfile,&controlstab)) {
!           if (errno == ENOENT)
              ohshit(_("conffile `%.250s' does not appear in package"),conffilename);
!           else
              ohshite(_("conffile `%.250s' is not stattable"),conffilename);
          } else if (!S_ISREG(controlstab.st_mode)) {
            fprintf(stderr, _("warning, conffile `%s'"
--- 286,296 ----
          strcat(controlfile, "/");
          strcat(controlfile, conffilename);
          if (lstat(controlfile,&controlstab)) {
!           if (errno == ENOENT){
! 	    if(n>1 && conffilename[n-2]==' ') fprintf(stderr, _("warning, "
! 	  	"conffile filename `%s' contains trailing white spaces\n"), conffilename);
              ohshit(_("conffile `%.250s' does not appear in package"),conffilename);
! 	  }else
              ohshite(_("conffile `%.250s' is not stattable"),conffilename);
          } else if (!S_ISREG(controlstab.st_mode)) {
            fprintf(stderr, _("warning, conffile `%s'"

Reply to: