debian mentors/ commonpackagingmistakes/ Using cp to install files
.........................

Using cp to install files in debian/rules

If a package uses cp to install files in to the directories from which the package will be created it can cause problems, particularly if the user who runs the build has a different umask set. dh_fixperms may catch some of the problems, but will not catch them all. This is one of a set of problems where the umask used in the build can cause the files in the .deb to have the wrong permissions. You should always check the permissions of the files within the .deb (dpkg -c will show them). You can also test for umask related problems by running the build with a stricter umask, e.g. 077. The problems will probably not be seen on autobuilt packages, but may be seen on local builds of packages.

To avoid this problem change any calls in debian/rules that look like

cp file debian/tmp/usr/share/...

to use the install command

install -m644 file debian/tmp/usr/share/...

See install(1) for more options that you can use.