Bug#281562: [DPKG-DEB] -b does not find conffiles if they have spaces at the end
Package: dpkg
Version: 1.10.25
Severity: normal
Tags: patch
When building a package, dpkg-deb stopped with this error:
dpkg-deb: conffile `etc/robplayer/usc_pioneer.cfg ' does not appear in
package
but:
ls -l etc/robplayer/
total 48
-rw-r--r-- 1 root root 546 Nov 16 13:33 colors.txt
-rw-r--r-- 1 root root 262 Nov 16 13:33 gazebo.cfg
-rw-r--r-- 1 root root 756 Nov 16 13:33 gazebo_blobfinder.cfg
-rw-r--r-- 1 root root 362 Nov 16 13:33 segwayrmp.cfg
-rw-r--r-- 1 root root 1503 Nov 16 13:33 umass_ATRVJr.cfg
-rw-r--r-- 1 root root 1444 Nov 16 13:33 umass_ATRVMini.cfg
-rw-r--r-- 1 root root 95 Nov 16 13:33 umass_reb.cfg
-rw-r--r-- 1 root root 241 Nov 16 13:33 usc_pioneer.cfg
-rw-r--r-- 1 root root 261 Nov 16 13:33 vfh.cfg
-rw-r--r-- 1 root root 1226 Nov 16 13:33 wavefront.cfg
The problem is the space after .cfg and before the \n. When the
string with the space is passed to lstat() it returns -1 and dpkg-deb
stops, even when the conffile is actually there.
Proposed solution: modify dpkg-deb/build.c, please consider the
following patch for the next dpkg release.
dave
*** dpkg-deb.build.c.patch
*** build.c.orig Thu Nov 11 21:10:03 2004
--- build.c Tue Nov 16 18:12:50 2004
***************
*** 281,287 ****
while ((c= getc(cf)) != EOF && c != '\n');
continue;
}
! conffilename[n-1]= 0;
strcpy(controlfile, directory);
strcat(controlfile, "/");
strcat(controlfile, conffilename);
--- 281,291 ----
while ((c= getc(cf)) != EOF && c != '\n');
continue;
}
!
! /* We have to remove trailing spaces or else lstat fails */
! if(n>1) while (conffilename[n-2]==' ') n--;
!
! conffilename[n-1]= 0;
strcpy(controlfile, directory);
strcat(controlfile, "/");
strcat(controlfile, conffilename);
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.6-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages dpkg depends on:
ii dselect 1.10.23 a user tool to manage Debian packa
ii libc6 2.3.2.ds1-18 GNU C Library: Shared libraries an
-- no debconf information
Reply to: